Compare commits

...

4 Commits

Author SHA1 Message Date
semantic-release-bot 1c17234025 chore(release): 0.2.0-develop.17 [skip ci]
# [0.2.0-develop.17](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.16...v0.2.0-develop.17) (2023-06-26)

### Features

* re-export most of noble utility functions ([a813ee3](a813ee35f3))
2023-06-26 04:43:36 +00:00
Derrick Hammer 381abb7486
Merge remote-tracking branch 'origin/develop' into develop 2023-06-26 00:42:36 -04:00
Derrick Hammer 42d52444c8
refactor: alias bufToHex to bytesToHex 2023-06-26 00:42:29 -04:00
Derrick Hammer a813ee35f3
feat: re-export most of noble utility functions 2023-06-26 00:39:25 -04:00
5 changed files with 36 additions and 13 deletions

View File

@ -1,3 +1,10 @@
# [0.2.0-develop.17](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.16...v0.2.0-develop.17) (2023-06-26)
### Features
* re-export most of noble utility functions ([a813ee3](https://git.lumeweb.com/LumeWeb/libweb/commit/a813ee35f359a6f019d53b3bad0d9585dcc0d23e))
# [0.2.0-develop.16](https://git.lumeweb.com/LumeWeb/libweb/compare/v0.2.0-develop.15...v0.2.0-develop.16) (2023-06-26)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.16",
"version": "0.2.0-develop.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.16",
"version": "0.2.0-develop.17",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.2",
"@lumeweb/libportal": "^0.2.0-develop.10",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libweb",
"version": "0.2.0-develop.16",
"version": "0.2.0-develop.17",
"main": "lib/index.js",
"type": "module",
"repository": {

View File

@ -1,5 +1,6 @@
import { addContextToErr } from "./err.js";
import { Err } from "./types.js";
import { bytesToHex } from "@noble/hashes/utils";
const MAX_UINT_64 = 18446744073709551615n;
@ -29,7 +30,7 @@ function b64ToBuf(b64: string): [Uint8Array, Err] {
// bufToHex takes a Uint8Array as input and returns the hex encoding of those
// bytes as a string.
function bufToHex(buf: Uint8Array): string {
return [...buf].map((x) => x.toString(16).padStart(2, "0")).join("");
return bytesToHex(buf);
}
// bufToB64 will convert a Uint8Array to a base64 string with URL encoding and
@ -119,12 +120,4 @@ function hexToBuf(hex: string): [Uint8Array, Err] {
return [u8, null];
}
export {
b64ToBuf,
bufToHex,
bufToB64,
bufToStr,
decodeU64,
encodeU64,
hexToBuf,
};
export { b64ToBuf, bufToB64, bufToStr, decodeU64, encodeU64, hexToBuf };

View File

@ -1,6 +1,29 @@
import { ed25519 } from "@noble/curves/ed25519";
import { sha512 } from "@noble/hashes/sha512";
export {
bytesToHex,
hexToBytes,
toBytes,
concatBytes,
randomBytes,
} from "@noble/hashes/utils";
export {
numberToHexUnpadded,
hexToNumber,
bytesToNumberBE,
bytesToNumberLE,
numberToBytesBE,
numberToBytesLE,
numberToVarBytesBE,
ensureBytes,
equalBytes,
utf8ToBytes,
bitLen,
bitGet,
bitSet,
bitMask,
} from "@noble/curves/abstract/utils";
export * from "./err.js";
export * from "./errTracker.js";
export * from "./objAsString.js";