@seed-hypermedia/client 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.mjs +2 -2
- package/dist/blobs.d.ts +2 -1
- package/dist/blobs.mjs +3 -1
- package/dist/capability.mjs +2 -2
- package/dist/{chunk-EZ5UFUMQ.mjs → chunk-2JSUDZLE.mjs} +1 -1
- package/dist/{chunk-SHOAYNJY.mjs → chunk-7PB3EULG.mjs} +1 -1
- package/dist/{chunk-SPVX5N6S.mjs → chunk-BO2QSSIU.mjs} +1 -1
- package/dist/{chunk-IT5LLTMP.mjs → chunk-NBCHK76Q.mjs} +27 -0
- package/dist/hmauth.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/vault-local.mjs +2 -2
- package/dist/vault-merge.mjs +2 -2
- package/dist/vault.mjs +2 -2
- package/package.json +1 -1
package/dist/auth.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
PARAM_TS,
|
|
12
12
|
validateClientId,
|
|
13
13
|
validateRedirectUri
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7PB3EULG.mjs";
|
|
15
15
|
import {
|
|
16
16
|
decode,
|
|
17
17
|
encode
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
principalFromString,
|
|
24
24
|
principalToString,
|
|
25
25
|
verify
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NBCHK76Q.mjs";
|
|
27
27
|
import "./chunk-DR3HJ6BV.mjs";
|
|
28
28
|
import {
|
|
29
29
|
decode as decode2
|
package/dist/blobs.d.ts
CHANGED
|
@@ -60,9 +60,10 @@ export declare class WebCryptoKeyPair implements Signer {
|
|
|
60
60
|
}
|
|
61
61
|
/** Generate a random Ed25519 key pair with an unexportable private key. */
|
|
62
62
|
export declare function generateWebCryptoKeyPair(): Promise<WebCryptoKeyPair>;
|
|
63
|
+
export declare const nativeCryptoReady: Promise<void>;
|
|
63
64
|
/**
|
|
64
65
|
* Verify the signature of a blob against its embedded signer Principal.
|
|
65
|
-
* Uses
|
|
66
|
+
* Uses native Ed25519 when available (server), @noble in the browser.
|
|
66
67
|
*/
|
|
67
68
|
export declare function verify(blob: Blob): boolean;
|
|
68
69
|
/** Create a Principal from a raw Ed25519 public key (32 bytes). */
|
package/dist/blobs.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
generateNobleKeyPair,
|
|
15
15
|
generateWebCryptoKeyPair,
|
|
16
16
|
keyPairFromPrivateKey,
|
|
17
|
+
nativeCryptoReady,
|
|
17
18
|
nobleKeyPairFromSeed,
|
|
18
19
|
principalEqual,
|
|
19
20
|
principalFromEd25519,
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
principalToString,
|
|
22
23
|
sign,
|
|
23
24
|
verify
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-NBCHK76Q.mjs";
|
|
25
26
|
import "./chunk-DR3HJ6BV.mjs";
|
|
26
27
|
import "./chunk-3TPCJCVO.mjs";
|
|
27
28
|
import "./chunk-7P6ASYW6.mjs";
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
generateNobleKeyPair,
|
|
42
43
|
generateWebCryptoKeyPair,
|
|
43
44
|
keyPairFromPrivateKey,
|
|
45
|
+
nativeCryptoReady,
|
|
44
46
|
nobleKeyPairFromSeed,
|
|
45
47
|
principalEqual,
|
|
46
48
|
principalFromEd25519,
|
package/dist/capability.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapability,
|
|
3
3
|
resolveCapability
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BO2QSSIU.mjs";
|
|
5
5
|
import "./chunk-LVAHHQIK.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
7
7
|
import "./chunk-DR3HJ6BV.mjs";
|
|
8
8
|
import "./chunk-MZUGCZJ6.mjs";
|
|
9
9
|
import "./chunk-3TPCJCVO.mjs";
|
|
@@ -61,6 +61,31 @@ async function generateWebCryptoKeyPair() {
|
|
|
61
61
|
const publicKeyRaw = new Uint8Array(await crypto.subtle.exportKey("raw", keyPair.publicKey));
|
|
62
62
|
return new WebCryptoKeyPair(keyPair, publicKeyRaw);
|
|
63
63
|
}
|
|
64
|
+
var ED25519_SPKI_DER_PREFIX = new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 112, 3, 33, 0]);
|
|
65
|
+
var nativeCrypto;
|
|
66
|
+
var nativeCryptoReady = (async () => {
|
|
67
|
+
try {
|
|
68
|
+
const mod = await import("module");
|
|
69
|
+
const base = (typeof process !== "undefined" && process.cwd ? process.cwd() : "/") + "/";
|
|
70
|
+
nativeCrypto = mod.createRequire(base)("node:crypto");
|
|
71
|
+
} catch {
|
|
72
|
+
nativeCrypto = null;
|
|
73
|
+
}
|
|
74
|
+
})();
|
|
75
|
+
var nativeKeyCache = /* @__PURE__ */ new Map();
|
|
76
|
+
function nativeVerify(nc, sig, data, rawPubKey) {
|
|
77
|
+
const cacheKey = base58btc.encode(rawPubKey);
|
|
78
|
+
let key = nativeKeyCache.get(cacheKey);
|
|
79
|
+
if (key === void 0) {
|
|
80
|
+
const spki = new Uint8Array(ED25519_SPKI_DER_PREFIX.length + rawPubKey.length);
|
|
81
|
+
spki.set(ED25519_SPKI_DER_PREFIX);
|
|
82
|
+
spki.set(rawPubKey, ED25519_SPKI_DER_PREFIX.length);
|
|
83
|
+
key = nc.createPublicKey({ key: spki, format: "der", type: "spki" });
|
|
84
|
+
if (nativeKeyCache.size > 1e3) nativeKeyCache.clear();
|
|
85
|
+
nativeKeyCache.set(cacheKey, key);
|
|
86
|
+
}
|
|
87
|
+
return nc.verify(null, data, key, sig);
|
|
88
|
+
}
|
|
64
89
|
function verify(blob) {
|
|
65
90
|
if (blob.signer[0] !== ED25519_VARINT_PREFIX[0] || blob.signer[1] !== ED25519_VARINT_PREFIX[1]) return false;
|
|
66
91
|
const rawPubKey = blob.signer.slice(ED25519_VARINT_PREFIX.length);
|
|
@@ -69,6 +94,7 @@ function verify(blob) {
|
|
|
69
94
|
const unsigned = { ...blob, sig: new Uint8Array(ED25519_SIGNATURE_SIZE) };
|
|
70
95
|
const data = new Uint8Array(encode(unsigned));
|
|
71
96
|
try {
|
|
97
|
+
if (nativeCrypto) return nativeVerify(nativeCrypto, sigCopy, data, rawPubKey);
|
|
72
98
|
return ed25519.verify(sigCopy, data, rawPubKey);
|
|
73
99
|
} catch {
|
|
74
100
|
return false;
|
|
@@ -193,6 +219,7 @@ export {
|
|
|
193
219
|
nobleKeyPairFromSeed,
|
|
194
220
|
WebCryptoKeyPair,
|
|
195
221
|
generateWebCryptoKeyPair,
|
|
222
|
+
nativeCryptoReady,
|
|
196
223
|
verify,
|
|
197
224
|
principalFromEd25519,
|
|
198
225
|
principalToString,
|
package/dist/hmauth.mjs
CHANGED
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
validateSessionKeyPrincipal,
|
|
22
22
|
validateState,
|
|
23
23
|
verifyDelegationRequestProof
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7PB3EULG.mjs";
|
|
25
25
|
import "./chunk-2MD3FXKB.mjs";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
27
27
|
import "./chunk-DR3HJ6BV.mjs";
|
|
28
28
|
import "./chunk-3TPCJCVO.mjs";
|
|
29
29
|
import "./chunk-7P6ASYW6.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -123,9 +123,9 @@ import {
|
|
|
123
123
|
import {
|
|
124
124
|
createCapability,
|
|
125
125
|
resolveCapability
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-BO2QSSIU.mjs";
|
|
127
127
|
import "./chunk-LVAHHQIK.mjs";
|
|
128
|
-
import "./chunk-
|
|
128
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
129
129
|
import {
|
|
130
130
|
toHMSigner,
|
|
131
131
|
toPrincipalSigner
|
package/dist/vault-local.mjs
CHANGED
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
principalFromPublicKey,
|
|
6
6
|
principalToString,
|
|
7
7
|
unwrapDEK
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2JSUDZLE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
readOSSecret,
|
|
11
11
|
stripGoKeyringPrefix
|
|
12
12
|
} from "./chunk-KNP335NP.mjs";
|
|
13
13
|
import "./chunk-UOL3F6XQ.mjs";
|
|
14
14
|
import "./chunk-2MD3FXKB.mjs";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
16
16
|
import "./chunk-DR3HJ6BV.mjs";
|
|
17
17
|
import "./chunk-3TPCJCVO.mjs";
|
|
18
18
|
import "./chunk-7P6ASYW6.mjs";
|
package/dist/vault-merge.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
accountIdFromSeed,
|
|
4
4
|
getUnknownFields,
|
|
5
5
|
setUnknownFields
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2JSUDZLE.mjs";
|
|
7
7
|
import "./chunk-UOL3F6XQ.mjs";
|
|
8
8
|
import "./chunk-2MD3FXKB.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
10
10
|
import "./chunk-DR3HJ6BV.mjs";
|
|
11
11
|
import "./chunk-3TPCJCVO.mjs";
|
|
12
12
|
import "./chunk-7P6ASYW6.mjs";
|
package/dist/vault.mjs
CHANGED
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
serializeState,
|
|
19
19
|
setUnknownFields,
|
|
20
20
|
unwrapDEK
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-2JSUDZLE.mjs";
|
|
22
22
|
import "./chunk-UOL3F6XQ.mjs";
|
|
23
23
|
import "./chunk-2MD3FXKB.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-NBCHK76Q.mjs";
|
|
25
25
|
import "./chunk-DR3HJ6BV.mjs";
|
|
26
26
|
import "./chunk-3TPCJCVO.mjs";
|
|
27
27
|
import "./chunk-7P6ASYW6.mjs";
|