Compare commits

..

No commits in common. "v0.2.0-develop.17" and "v0.2.0-develop.16" have entirely different histories.

5 changed files with 13 additions and 36 deletions

View File

@ -1,10 +1,3 @@
# [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) # [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", "name": "@lumeweb/libweb",
"version": "0.2.0-develop.17", "version": "0.2.0-develop.16",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lumeweb/libweb", "name": "@lumeweb/libweb",
"version": "0.2.0-develop.17", "version": "0.2.0-develop.16",
"dependencies": { "dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.2", "@lumeweb/community-portals": "^0.1.0-develop.2",
"@lumeweb/libportal": "^0.2.0-develop.10", "@lumeweb/libportal": "^0.2.0-develop.10",

View File

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

View File

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

View File

@ -1,29 +1,6 @@
import { ed25519 } from "@noble/curves/ed25519"; import { ed25519 } from "@noble/curves/ed25519";
import { sha512 } from "@noble/hashes/sha512"; 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 "./err.js";
export * from "./errTracker.js"; export * from "./errTracker.js";
export * from "./objAsString.js"; export * from "./objAsString.js";