wire-mesh-core 4.1.2 → 4.1.4
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/adapters/byte-stream-connection.d.cts +2 -2
- package/dist/adapters/byte-stream-connection.d.mts +2 -2
- package/dist/adapters/frame-codec.d.cts +1 -1
- package/dist/adapters/frame-codec.d.mts +1 -1
- package/dist/adapters/node-identity.cjs +7 -1
- package/dist/adapters/node-identity.d.cts +2 -2
- package/dist/adapters/node-identity.d.mts +2 -2
- package/dist/adapters/node-identity.mjs +7 -1
- package/dist/adapters/tcp-transport.d.cts +1 -1
- package/dist/adapters/tcp-transport.d.mts +1 -1
- package/dist/adapters/threshold-identity.d.cts +2 -2
- package/dist/adapters/threshold-identity.d.mts +2 -2
- package/dist/adapters/threshold-wasm.d.cts +1 -1
- package/dist/adapters/threshold-wasm.d.mts +1 -1
- package/dist/adapters/tls-transport.d.cts +1 -1
- package/dist/adapters/tls-transport.d.mts +1 -1
- package/dist/domain/advert-extension-policy.d.cts +1 -1
- package/dist/domain/advert-extension-policy.d.mts +1 -1
- package/dist/domain/bulk.d.cts +2 -2
- package/dist/domain/bulk.d.mts +2 -2
- package/dist/domain/capability-grant.d.cts +2 -2
- package/dist/domain/capability-grant.d.mts +2 -2
- package/dist/domain/capability-request.d.cts +3 -3
- package/dist/domain/capability-request.d.mts +3 -3
- package/dist/domain/coordinator-election.d.cts +1 -1
- package/dist/domain/coordinator-election.d.mts +1 -1
- package/dist/domain/data-sync.d.cts +2 -2
- package/dist/domain/data-sync.d.mts +2 -2
- package/dist/domain/device-id.d.cts +1 -1
- package/dist/domain/device-id.d.mts +1 -1
- package/dist/domain/direct-manage-request.d.cts +2 -2
- package/dist/domain/direct-manage-request.d.mts +2 -2
- package/dist/domain/ed25519-identity-key.cjs +152 -0
- package/dist/domain/ed25519-identity-key.d.cts +13 -0
- package/dist/domain/ed25519-identity-key.d.mts +13 -0
- package/dist/domain/ed25519-identity-key.mjs +150 -0
- package/dist/domain/gossip-expansion.d.cts +1 -1
- package/dist/domain/gossip-expansion.d.mts +1 -1
- package/dist/domain/grant-candidates.d.cts +1 -1
- package/dist/domain/grant-candidates.d.mts +1 -1
- package/dist/domain/handshake.d.cts +1 -1
- package/dist/domain/handshake.d.mts +1 -1
- package/dist/domain/hub-mailbox.d.cts +1 -1
- package/dist/domain/hub-mailbox.d.mts +1 -1
- package/dist/domain/mesh-session.cjs +1 -1
- package/dist/domain/mesh-session.d.cts +3 -3
- package/dist/domain/mesh-session.d.mts +3 -3
- package/dist/domain/mesh-session.mjs +1 -1
- package/dist/domain/notice-board.d.cts +2 -2
- package/dist/domain/notice-board.d.mts +2 -2
- package/dist/domain/path-trace.d.cts +1 -1
- package/dist/domain/path-trace.d.mts +1 -1
- package/dist/domain/peer-advert.d.cts +2 -2
- package/dist/domain/peer-advert.d.mts +2 -2
- package/dist/domain/relay-advert.d.cts +1 -1
- package/dist/domain/relay-advert.d.mts +1 -1
- package/dist/domain/relay-hub.d.cts +2 -2
- package/dist/domain/relay-hub.d.mts +2 -2
- package/dist/domain/relay-use-gate.d.cts +2 -2
- package/dist/domain/relay-use-gate.d.mts +2 -2
- package/dist/domain/revocation-view.d.cts +1 -1
- package/dist/domain/revocation-view.d.mts +1 -1
- package/dist/domain/room-rekey.d.cts +2 -2
- package/dist/domain/room-rekey.d.mts +2 -2
- package/dist/domain/room-token-verification.d.cts +1 -1
- package/dist/domain/room-token-verification.d.mts +1 -1
- package/dist/domain/room.cjs +2 -1
- package/dist/domain/room.d.cts +3 -3
- package/dist/domain/room.d.mts +3 -3
- package/dist/domain/room.mjs +2 -1
- package/dist/domain/shard-manifest.d.cts +1 -1
- package/dist/domain/shard-manifest.d.mts +1 -1
- package/dist/domain/token-predicates.d.cts +1 -1
- package/dist/domain/token-predicates.d.mts +1 -1
- package/dist/domain/token-scope.d.cts +1 -1
- package/dist/domain/token-scope.d.mts +1 -1
- package/dist/domain/tokens.cjs +3 -2
- package/dist/domain/tokens.d.cts +3 -3
- package/dist/domain/tokens.d.mts +3 -3
- package/dist/domain/tokens.mjs +3 -2
- package/dist/domain/topology-snapshot.d.cts +1 -1
- package/dist/domain/topology-snapshot.d.mts +1 -1
- package/dist/domain/topology.d.cts +1 -1
- package/dist/domain/topology.d.mts +1 -1
- package/dist/domain/webrtc-signaling.d.cts +1 -1
- package/dist/domain/webrtc-signaling.d.mts +1 -1
- package/dist/generated/protocol.cjs +8 -8
- package/dist/generated/protocol.d.cts +1 -1
- package/dist/generated/protocol.d.mts +1 -1
- package/dist/generated/protocol.mjs +8 -8
- package/dist/{identity-BioGOV9M.d.mts → identity-CQof0iEM.d.cts} +4 -2
- package/dist/{identity-C5jq53NV.d.cts → identity-CUr-jaAB.d.mts} +4 -2
- package/dist/ports/identity.cjs +10 -0
- package/dist/ports/identity.d.cts +2 -2
- package/dist/ports/identity.d.mts +2 -2
- package/dist/ports/identity.mjs +10 -1
- package/dist/ports/transport.d.cts +1 -1
- package/dist/ports/transport.d.mts +1 -1
- package/dist/{protocol-DzmpxxUr.d.cts → protocol-Cb3BnuTL.d.cts} +346 -346
- package/dist/{protocol-DzmpxxUr.d.mts → protocol-Cb3BnuTL.d.mts} +346 -346
- package/dist/{room-token-verification-Hb1LkpFh.d.mts → room-token-verification-B1doIXmJ.d.mts} +1 -1
- package/dist/{room-token-verification-Dh7SGJfK.d.cts → room-token-verification-DuXqERah.d.cts} +1 -1
- package/dist/{token-predicates-CrieP1WI.d.mts → token-predicates-CS4DprDE.d.mts} +1 -1
- package/dist/{token-predicates-lg4TtUxm.d.cts → token-predicates-ooQCcAZm.d.cts} +1 -1
- package/dist/{transport-bD3p_TO_.d.mts → transport-CAD419ge.d.mts} +1 -1
- package/dist/{transport-gDbSHO-r.d.cts → transport-DaeS9N-o.d.cts} +1 -1
- package/package.json +7 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Frame } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { N as Frame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
3
|
//#region src/adapters/byte-stream-connection.d.ts
|
|
4
4
|
/** The largest frame body a peer may announce in a length prefix, matching the 100 MiB the `ws` package applies to one message on the same hub, so a WebSocket peer and a byte-stream peer are bounded alike. Without a bound a peer-controlled 4 GiB prefix makes the reader buffer until memory runs out. */
|
|
5
5
|
export declare const MAX_FRAME_BYTES: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Frame } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { N as Frame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
3
|
//#region src/adapters/byte-stream-connection.d.ts
|
|
4
4
|
/** The largest frame body a peer may announce in a length prefix, matching the 100 MiB the `ws` package applies to one message on the same hub, so a WebSocket peer and a byte-stream peer are bounded alike. Without a bound a peer-controlled 4 GiB prefix makes the reader buffer until memory runs out. */
|
|
5
5
|
export declare const MAX_FRAME_BYTES: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** Wraps frame as a relay-data-frame's own opaque payload, stamping to-device when the caller knows which established pairing to address it to (wire-mesh#30) -- the outbound counterpart to tryDecodeFrame's own doc comment below, which describes the inbound side of the same relay-data envelope. Omitting toDevice leaves the frame unaddressed, which the receiving hub then routes via its own most-recently-established-pairing fallback. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, N as Frame, ht as RelayDataFrame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/adapters/frame-codec.d.ts
|
|
3
3
|
export declare function messageFromFrame(frame: Frame): Uint8Array<ArrayBuffer>;
|
|
4
4
|
/** Wraps frame as a relay-data-frame's own opaque payload, stamping to-device when the caller knows which established pairing to address it to (wire-mesh#30) -- the outbound counterpart to tryDecodeFrame's own doc comment below, which describes the inbound side of the same relay-data envelope. Omitting toDevice leaves the frame unaddressed, which the receiving hub then routes via its own most-recently-established-pairing fallback. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_domain_ed25519_identity_key = require("../domain/ed25519-identity-key.cjs");
|
|
2
3
|
const require_ports_identity = require("../ports/identity.cjs");
|
|
3
4
|
let node_crypto = require("node:crypto");
|
|
4
5
|
//#region src/adapters/node-identity.ts
|
|
@@ -38,6 +39,10 @@ function importedKeyId(key) {
|
|
|
38
39
|
}
|
|
39
40
|
async function importPublicKey(key) {
|
|
40
41
|
if (key["public-key"].length !== publicKeySize(key.alg)) throw new require_ports_identity.IdentityKeyError("invalid_key", `identity-key public-key is ${String(key["public-key"].length)} bytes, not the ${String(publicKeySize(key.alg))} an alg ${String(key.alg)} key has`);
|
|
42
|
+
if (key.alg === EDDSA) {
|
|
43
|
+
const fault = require_domain_ed25519_identity_key.ed25519KeyFault(key["public-key"]);
|
|
44
|
+
if (fault !== void 0) throw new require_ports_identity.IdentityKeyError("invalid_key", `identity-key public-key is not a usable Ed25519 key (${fault})`);
|
|
45
|
+
}
|
|
41
46
|
const id = importedKeyId(key);
|
|
42
47
|
const held = importedKeys.get(id);
|
|
43
48
|
if (held !== void 0) {
|
|
@@ -54,7 +59,7 @@ async function importPublicKey(key) {
|
|
|
54
59
|
}
|
|
55
60
|
return pending;
|
|
56
61
|
}
|
|
57
|
-
/** Imports the raw public key, reporting a key the algorithm cannot import (not a point on the curve, for ES256) as an IdentityKeyError rather than the Web Crypto error it arrives as. An Ed25519
|
|
62
|
+
/** Imports the raw public key, reporting a key the algorithm cannot import (not a point on the curve, for ES256) as an IdentityKeyError rather than the Web Crypto error it arrives as. An Ed25519 key is checked before this by `ed25519KeyFault`, since the import itself accepts keys that are not points. */
|
|
58
63
|
async function importRawPublicKey(key, algorithm) {
|
|
59
64
|
try {
|
|
60
65
|
return await node_crypto.webcrypto.subtle.importKey("raw", toBufferSource(key["public-key"]), algorithm, false, ["verify"]);
|
|
@@ -75,6 +80,7 @@ async function deriveDeviceId(publicKey) {
|
|
|
75
80
|
}
|
|
76
81
|
async function verifyWithPublicKey(key, message, signature) {
|
|
77
82
|
const cryptoKey = await importPublicKey(key);
|
|
83
|
+
if (key.alg === EDDSA && !require_domain_ed25519_identity_key.ed25519SignatureIsStrict(signature)) return false;
|
|
78
84
|
return node_crypto.webcrypto.subtle.verify(algParams(key.alg), cryptoKey, toBufferSource(signature), toBufferSource(message));
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as IdentityKey, D as DeviceId } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { B as IdentityKey, D as DeviceId } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/adapters/node-identity.d.ts
|
|
5
5
|
export declare function deriveDeviceId(publicKey: Uint8Array): Promise<DeviceId>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ed25519KeyFault, ed25519SignatureIsStrict } from "../domain/ed25519-identity-key.mjs";
|
|
1
2
|
import { IdentityKeyError } from "../ports/identity.mjs";
|
|
2
3
|
import { webcrypto } from "node:crypto";
|
|
3
4
|
//#region src/adapters/node-identity.ts
|
|
@@ -37,6 +38,10 @@ function importedKeyId(key) {
|
|
|
37
38
|
}
|
|
38
39
|
async function importPublicKey(key) {
|
|
39
40
|
if (key["public-key"].length !== publicKeySize(key.alg)) throw new IdentityKeyError("invalid_key", `identity-key public-key is ${String(key["public-key"].length)} bytes, not the ${String(publicKeySize(key.alg))} an alg ${String(key.alg)} key has`);
|
|
41
|
+
if (key.alg === EDDSA) {
|
|
42
|
+
const fault = ed25519KeyFault(key["public-key"]);
|
|
43
|
+
if (fault !== void 0) throw new IdentityKeyError("invalid_key", `identity-key public-key is not a usable Ed25519 key (${fault})`);
|
|
44
|
+
}
|
|
40
45
|
const id = importedKeyId(key);
|
|
41
46
|
const held = importedKeys.get(id);
|
|
42
47
|
if (held !== void 0) {
|
|
@@ -53,7 +58,7 @@ async function importPublicKey(key) {
|
|
|
53
58
|
}
|
|
54
59
|
return pending;
|
|
55
60
|
}
|
|
56
|
-
/** Imports the raw public key, reporting a key the algorithm cannot import (not a point on the curve, for ES256) as an IdentityKeyError rather than the Web Crypto error it arrives as. An Ed25519
|
|
61
|
+
/** Imports the raw public key, reporting a key the algorithm cannot import (not a point on the curve, for ES256) as an IdentityKeyError rather than the Web Crypto error it arrives as. An Ed25519 key is checked before this by `ed25519KeyFault`, since the import itself accepts keys that are not points. */
|
|
57
62
|
async function importRawPublicKey(key, algorithm) {
|
|
58
63
|
try {
|
|
59
64
|
return await webcrypto.subtle.importKey("raw", toBufferSource(key["public-key"]), algorithm, false, ["verify"]);
|
|
@@ -74,6 +79,7 @@ async function deriveDeviceId(publicKey) {
|
|
|
74
79
|
}
|
|
75
80
|
async function verifyWithPublicKey(key, message, signature) {
|
|
76
81
|
const cryptoKey = await importPublicKey(key);
|
|
82
|
+
if (key.alg === EDDSA && !ed25519SignatureIsStrict(signature)) return false;
|
|
77
83
|
return webcrypto.subtle.verify(algParams(key.alg), cryptoKey, toBufferSource(signature), toBufferSource(message));
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Transport } from "../transport-
|
|
1
|
+
import { r as Transport } from "../transport-DaeS9N-o.cjs";
|
|
2
2
|
//#region src/adapters/tcp-transport.d.ts
|
|
3
3
|
/** A Node net.Socket-based Transport: length-prefixed, CBOR-encoded frames over plain TCP -- matching Cascade's own transport shape, since interop with Cascade nodes is wire-mesh's stated goal. Framing (not TLS) is this adapter's own concern; a TLS-terminated variant is a separate adapter behind the same Transport contract. */
|
|
4
4
|
export declare function createTcpTransport(): Transport;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Transport } from "../transport-
|
|
1
|
+
import { r as Transport } from "../transport-CAD419ge.mjs";
|
|
2
2
|
//#region src/adapters/tcp-transport.d.ts
|
|
3
3
|
/** A Node net.Socket-based Transport: length-prefixed, CBOR-encoded frames over plain TCP -- matching Cascade's own transport shape, since interop with Cascade nodes is wire-mesh's stated goal. Framing (not TLS) is this adapter's own concern; a TLS-terminated variant is a separate adapter behind the same Transport contract. */
|
|
4
4
|
export declare function createTcpTransport(): Transport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { DeviceKeyed } from "./threshold-wasm.cjs";
|
|
4
4
|
import { ThresholdSubject } from "../domain/threshold-subject.cjs";
|
|
5
5
|
//#region src/adapters/threshold-identity.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { DeviceKeyed } from "./threshold-wasm.mjs";
|
|
4
4
|
import { ThresholdSubject } from "../domain/threshold-subject.mjs";
|
|
5
5
|
//#region src/adapters/threshold-identity.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/adapters/threshold-wasm.d.ts
|
|
3
3
|
/** One `(deviceId, bytes)` pair -- the wasm boundary's own encoding of a map keyed by participant, since wasm-bindgen has no built-in `Map<Uint8Array, Uint8Array>` marshalling. */
|
|
4
4
|
export interface DeviceKeyed<T extends Uint8Array = Uint8Array<ArrayBuffer>> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/adapters/threshold-wasm.d.ts
|
|
3
3
|
/** One `(deviceId, bytes)` pair -- the wasm boundary's own encoding of a map keyed by participant, since wasm-bindgen has no built-in `Map<Uint8Array, Uint8Array>` marshalling. */
|
|
4
4
|
export interface DeviceKeyed<T extends Uint8Array = Uint8Array<ArrayBuffer>> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { et as PeerAdvert } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/advert-extension-policy.d.ts
|
|
3
3
|
/** Whether one extension entry's value is one the hub will carry. Must be strict: a value with a field the validator did not expect is refused, since the point is that nothing unexpected is published. */
|
|
4
4
|
export type ExtensionValidator = (value: unknown) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as PeerAdvert } from "../protocol-
|
|
1
|
+
import { et as PeerAdvert } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/advert-extension-policy.d.ts
|
|
3
3
|
/** Whether one extension entry's value is one the hub will carry. Must be strict: a value with a field the validator did not expect is refused, since the point is that nothing unexpected is published. */
|
|
4
4
|
export type ExtensionValidator = (value: unknown) => boolean;
|
package/dist/domain/bulk.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
3
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.cjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.cjs";
|
|
5
5
|
//#region src/domain/bulk.d.ts
|
package/dist/domain/bulk.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, N as Frame, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
3
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.mjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.mjs";
|
|
5
5
|
//#region src/domain/bulk.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.cjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.cjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
4
4
|
import { IncomingManageRequest, ManageOutcome, MeshSession } from "./mesh-session.mjs";
|
|
5
5
|
import { RevocationCheck } from "./tokens.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken, u as CapabilityGrantOk } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken, u as CapabilityGrantOk } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.cjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.cjs";
|
|
5
|
-
import { m as TokenDelegateHandler, r as ConditionsContext } from "../token-predicates-
|
|
5
|
+
import { m as TokenDelegateHandler, r as ConditionsContext } from "../token-predicates-ooQCcAZm.cjs";
|
|
6
6
|
import { RevocationCheck } from "./tokens.cjs";
|
|
7
7
|
//#region src/domain/capability-request.d.ts
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken, u as CapabilityGrantOk } from "../protocol-
|
|
2
|
-
import { r as IdentityPort } from "../identity-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken, u as CapabilityGrantOk } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
3
3
|
import { t as Clock } from "../clock-DhUPRfLh.mjs";
|
|
4
4
|
import { IncomingManageRequest, MeshSession } from "./mesh-session.mjs";
|
|
5
|
-
import { m as TokenDelegateHandler, r as ConditionsContext } from "../token-predicates-
|
|
5
|
+
import { m as TokenDelegateHandler, r as ConditionsContext } from "../token-predicates-CS4DprDE.mjs";
|
|
6
6
|
import { RevocationCheck } from "./tokens.mjs";
|
|
7
7
|
//#region src/domain/capability-request.d.ts
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, g as CoordinatorFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, g as CoordinatorFrame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/coordinator-election.d.ts
|
|
3
3
|
/** The claim this side currently accepts: one coordinator, at the term that put it there. */
|
|
4
4
|
export interface CoordinatorClaim {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId, g as CoordinatorFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, g as CoordinatorFrame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/coordinator-election.d.ts
|
|
3
3
|
/** The claim this side currently accepts: one coordinator, at the term that put it there. */
|
|
4
4
|
export interface CoordinatorClaim {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.cjs";
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
3
|
+
import { r as IdentityPort } from "../identity-CQof0iEM.cjs";
|
|
4
4
|
//#region src/domain/data-sync.d.ts
|
|
5
5
|
export interface DataSyncOptions {
|
|
6
6
|
identity: IdentityPort;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-
|
|
1
|
+
import { D as DeviceId, E as DataRequestFrame, T as DataHaveFrame, w as DataEntriesFrame } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
import { t as KeyValueStorage } from "../storage-jbGFAYIV.mjs";
|
|
3
|
-
import { r as IdentityPort } from "../identity-
|
|
3
|
+
import { r as IdentityPort } from "../identity-CUr-jaAB.mjs";
|
|
4
4
|
//#region src/domain/data-sync.d.ts
|
|
5
5
|
export interface DataSyncOptions {
|
|
6
6
|
identity: IdentityPort;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.cjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeviceId } from "../protocol-
|
|
1
|
+
import { D as DeviceId } from "../protocol-Cb3BnuTL.mjs";
|
|
2
2
|
//#region src/domain/device-id.d.ts
|
|
3
3
|
/** Lowercase, byte-exact hex for an arbitrary-length byte string -- the same encoding convention deviceIdToHex uses for the fixed-length device-id case, extracted so any other byte string needing a stable, displayable, map-keyable text form (e.g. a token-id, which tokens.cddl defines as an arbitrary-length bstr rather than a 32-byte device-id) can use the identical convention without going through a device-id-shaped function. */
|
|
4
4
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.cjs";
|
|
2
|
+
import { r as Transport, t as Connection } from "../transport-DaeS9N-o.cjs";
|
|
3
3
|
import { IncomingManageRequest, ManageOutcome } from "./mesh-session.cjs";
|
|
4
4
|
//#region src/domain/direct-manage-request.d.ts
|
|
5
5
|
/** Reads exactly one frame off a freshly-accepted, bare connection and, if it's a manage-request, returns an IncomingManageRequest ready to hand to the same application-level dispatch logic session.incomingManageRequests already feeds elsewhere -- no handshake or gossip is ever read or sent on this connection (wire-mesh#38: the manage-request/manage-response exchange has no dependency on handshake state at the dispatch layer, confirmed against mesh-session.ts's own applyManageRequest/applyFrame). respond() sends the manage-response directly and closes the connection, since a one-off request/response is this connection's entire purpose -- unlike a real MeshSession, there is nothing further to do with it afterwards. Resolves null, without closing the connection (that's the caller's call), for any other first frame or if the connection ends before one arrives: interpreting either case is a Transport.listen() caller's own business, e.g. peeking the first frame to route between this path and acceptMeshSession's own handshake path. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-
|
|
2
|
-
import { r as Transport, t as Connection } from "../transport-
|
|
1
|
+
import { D as DeviceId, V as ManageCommand, f as CapabilityScope, p as CapabilityToken } from "../protocol-Cb3BnuTL.mjs";
|
|
2
|
+
import { r as Transport, t as Connection } from "../transport-CAD419ge.mjs";
|
|
3
3
|
import { IncomingManageRequest, ManageOutcome } from "./mesh-session.mjs";
|
|
4
4
|
//#region src/domain/direct-manage-request.d.ts
|
|
5
5
|
/** Reads exactly one frame off a freshly-accepted, bare connection and, if it's a manage-request, returns an IncomingManageRequest ready to hand to the same application-level dispatch logic session.incomingManageRequests already feeds elsewhere -- no handshake or gossip is ever read or sent on this connection (wire-mesh#38: the manage-request/manage-response exchange has no dependency on handshake state at the dispatch layer, confirmed against mesh-session.ts's own applyManageRequest/applyFrame). respond() sends the manage-response directly and closes the connection, since a one-off request/response is this connection's entire purpose -- unlike a real MeshSession, there is nothing further to do with it afterwards. Resolves null, without closing the connection (that's the caller's call), for any other first frame or if the connection ends before one arrives: interpreting either case is a Transport.listen() caller's own business, e.g. peeking the first frame to route between this path and acceptMeshSession's own handshake path. */
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_domain_device_id = require("./device-id.cjs");
|
|
3
|
+
//#region src/domain/ed25519-identity-key.ts
|
|
4
|
+
/**
|
|
5
|
+
* What an Ed25519 identity-key must be, and what an Ed25519 signature under one must look like, decided here and nowhere else, before the platform's crypto library is consulted.
|
|
6
|
+
*
|
|
7
|
+
* A key is usable when it is exactly 32 bytes, is the canonical encoding of a point on the curve (its y coordinate is below the field prime, and it decodes), is not a point of small order (the eight points of the torsion subgroup, the identity element among them), and lies in the prime-order subgroup (it has no torsion component). A signature is acceptable to verify when its S is below the group order and its R is a canonical encoding that is not a small-order point. The signature equation itself is the cofactorless one, `[S]B = R + [k]A` compared as encodings, which Web Crypto's Ed25519 verification does on the platforms the conformance vectors are run on: a platform that verifies differently fails the mixed-order vectors there. The Rust crates apply the same rules through ed25519-dalek's `is_weak`, `is_torsion_free` and `verify_strict`.
|
|
8
|
+
*/
|
|
9
|
+
const BITS_PER_BYTE = 8;
|
|
10
|
+
const THREE = 3;
|
|
11
|
+
const FOUR = 4;
|
|
12
|
+
const EIGHT = 8;
|
|
13
|
+
const FIELD_BITS = 255;
|
|
14
|
+
const PRIME_OFFSET = 19;
|
|
15
|
+
const ORDER_BITS = 252;
|
|
16
|
+
const PUBLIC_KEY_BYTES = 32;
|
|
17
|
+
const SIGNATURE_BYTES = 64;
|
|
18
|
+
const BYTE_BITS = BigInt(BITS_PER_BYTE);
|
|
19
|
+
const SIGN_BIT_BYTE = 31;
|
|
20
|
+
const SIGN_BIT_MASK = 127;
|
|
21
|
+
const ZERO = BigInt(0);
|
|
22
|
+
const ONE = BigInt(1);
|
|
23
|
+
const TWO = BigInt(2);
|
|
24
|
+
/** The field prime, 2^255 - 19. */
|
|
25
|
+
const FIELD_PRIME = (ONE << BigInt(FIELD_BITS)) - BigInt(PRIME_OFFSET);
|
|
26
|
+
/** The order of the prime-order subgroup. */
|
|
27
|
+
const GROUP_ORDER = (ONE << BigInt(ORDER_BITS)) + BigInt("27742317777372353535851937790883648493");
|
|
28
|
+
/** The curve constant d = -121665 / 121666, as a field element. */
|
|
29
|
+
const CURVE_D = BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555");
|
|
30
|
+
/**
|
|
31
|
+
* The y coordinates of the eight small-order points: 0 (two points of order 4), 1 (the identity element), -1 (order 2) and the two pairs of order 8. Both signs of x share each y, so a key is small-order exactly when its y is one of these, whatever its sign bit.
|
|
32
|
+
*/
|
|
33
|
+
const SMALL_ORDER_Y = new Set([
|
|
34
|
+
"0",
|
|
35
|
+
"1",
|
|
36
|
+
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec",
|
|
37
|
+
"5fc536d880238b13933c6d305acdfd5f098eff289f4c345b027b2c28f95e826",
|
|
38
|
+
"7a03ac9277fdc74ec6cc392cfa53202a0f67100d760b3cba4fd84d3d706a17c7"
|
|
39
|
+
].map((hex) => BigInt(`0x${hex}`)));
|
|
40
|
+
function littleEndian(bytes) {
|
|
41
|
+
let value = ZERO;
|
|
42
|
+
for (let index = bytes.length - 1; index >= 0; index -= 1) value = value << BYTE_BITS | BigInt(bytes[index] ?? 0);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
/** The y coordinate an encoding carries: the 255 low bits, with the sign bit of x cleared. */
|
|
46
|
+
function encodedY(encoding) {
|
|
47
|
+
const bytes = Uint8Array.from(encoding);
|
|
48
|
+
bytes[SIGN_BIT_BYTE] = (bytes[SIGN_BIT_BYTE] ?? 0) & SIGN_BIT_MASK;
|
|
49
|
+
return littleEndian(bytes);
|
|
50
|
+
}
|
|
51
|
+
function modPow(base, exponent) {
|
|
52
|
+
let result = ONE;
|
|
53
|
+
let factor = base % FIELD_PRIME;
|
|
54
|
+
let remaining = exponent;
|
|
55
|
+
while (remaining > ZERO) {
|
|
56
|
+
if ((remaining & ONE) === ONE) result = result * factor % FIELD_PRIME;
|
|
57
|
+
factor = factor * factor % FIELD_PRIME;
|
|
58
|
+
remaining >>= ONE;
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function mod(value) {
|
|
63
|
+
const reduced = value % FIELD_PRIME;
|
|
64
|
+
return reduced >= ZERO ? reduced : reduced + FIELD_PRIME;
|
|
65
|
+
}
|
|
66
|
+
/** sqrt(-1) modulo the prime: 2^((p - 1) / 4). */
|
|
67
|
+
const SQRT_MINUS_ONE = modPow(TWO, (FIELD_PRIME - ONE) / BigInt(FOUR));
|
|
68
|
+
/** A point with the given y, with either sign of x (negating a point preserves its order, so the sign does not matter to a subgroup test), or `undefined` when no point has that y. */
|
|
69
|
+
function pointWithY(y) {
|
|
70
|
+
const ySquared = mod(y * y);
|
|
71
|
+
const target = mod(mod(ySquared - ONE) * modPow(mod(CURVE_D * ySquared + ONE), FIELD_PRIME - TWO));
|
|
72
|
+
const candidate = modPow(target, (FIELD_PRIME + BigInt(THREE)) / BigInt(EIGHT));
|
|
73
|
+
for (const x of [candidate, mod(candidate * SQRT_MINUS_ONE)]) if (mod(x * x) === target) return {
|
|
74
|
+
x,
|
|
75
|
+
y,
|
|
76
|
+
z: ONE,
|
|
77
|
+
t: mod(x * y)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** The sum of two points: the unified, complete addition of Hisil, Wong, Carter and Dawson for a = -1, which doubles as the doubling. */
|
|
81
|
+
function addPoints(p, q) {
|
|
82
|
+
const a = mod((p.y - p.x) * (q.y - q.x));
|
|
83
|
+
const b = mod((p.y + p.x) * (q.y + q.x));
|
|
84
|
+
const c = mod(p.t * TWO * CURVE_D * q.t);
|
|
85
|
+
const d = mod(p.z * TWO * q.z);
|
|
86
|
+
const e = b - a;
|
|
87
|
+
const f = d - c;
|
|
88
|
+
const g = d + c;
|
|
89
|
+
const h = b + a;
|
|
90
|
+
return {
|
|
91
|
+
x: mod(e * f),
|
|
92
|
+
y: mod(g * h),
|
|
93
|
+
z: mod(f * g),
|
|
94
|
+
t: mod(e * h)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const IDENTITY_POINT = {
|
|
98
|
+
x: ZERO,
|
|
99
|
+
y: ONE,
|
|
100
|
+
z: ONE,
|
|
101
|
+
t: ZERO
|
|
102
|
+
};
|
|
103
|
+
/** Whether the point is in the prime-order subgroup: multiplying it by the group order gives the identity element. The point and the order are public, so the double-and-add loop leaks nothing. It costs one doubling per bit of the order below the top (252) and one addition per set bit below the top (72), each a handful of field multiplications, once per distinct key. */
|
|
104
|
+
function isTorsionFree(point) {
|
|
105
|
+
let result = IDENTITY_POINT;
|
|
106
|
+
for (let bit = ORDER_BITS; bit >= 0; bit -= 1) {
|
|
107
|
+
result = addPoints(result, result);
|
|
108
|
+
if ((GROUP_ORDER >> BigInt(bit) & ONE) === ONE) result = addPoints(result, point);
|
|
109
|
+
}
|
|
110
|
+
return result.x === ZERO && result.y === result.z;
|
|
111
|
+
}
|
|
112
|
+
/** How many key verdicts are remembered, so a key that signs many messages is checked for torsion once and a flood of distinct keys cannot grow the memory without bound. */
|
|
113
|
+
const VERDICT_CAPACITY = 1024;
|
|
114
|
+
const verdicts = /* @__PURE__ */ new Map();
|
|
115
|
+
function keyFaultUncached(publicKey) {
|
|
116
|
+
if (publicKey.length !== PUBLIC_KEY_BYTES) return "wrong_size";
|
|
117
|
+
const y = encodedY(publicKey);
|
|
118
|
+
if (y >= FIELD_PRIME) return "non_canonical";
|
|
119
|
+
const point = pointWithY(y);
|
|
120
|
+
if (point === void 0) return "not_a_point";
|
|
121
|
+
if (SMALL_ORDER_Y.has(y)) return "small_order";
|
|
122
|
+
return isTorsionFree(point) ? void 0 : "mixed_order";
|
|
123
|
+
}
|
|
124
|
+
/** The first reason an Ed25519 identity-key's bytes are refused, or `undefined` for a usable key. The checks are independent of the platform's crypto library, and the verdict for a key is remembered (the least recently used first goes once more than a fixed number are held), so verifying many signatures under one key tests it for torsion once. */
|
|
125
|
+
function ed25519KeyFault(publicKey) {
|
|
126
|
+
if (publicKey.length !== PUBLIC_KEY_BYTES) return "wrong_size";
|
|
127
|
+
const id = require_domain_device_id.bytesToHex(publicKey);
|
|
128
|
+
if (verdicts.has(id)) {
|
|
129
|
+
const held = verdicts.get(id);
|
|
130
|
+
verdicts.delete(id);
|
|
131
|
+
verdicts.set(id, held);
|
|
132
|
+
return held;
|
|
133
|
+
}
|
|
134
|
+
const fault = keyFaultUncached(publicKey);
|
|
135
|
+
verdicts.set(id, fault);
|
|
136
|
+
for (const oldest of verdicts.keys()) {
|
|
137
|
+
if (verdicts.size <= VERDICT_CAPACITY) break;
|
|
138
|
+
verdicts.delete(oldest);
|
|
139
|
+
}
|
|
140
|
+
return fault;
|
|
141
|
+
}
|
|
142
|
+
/** Whether a 64-byte Ed25519 signature is acceptable to verify: S below the group order, and R a canonical encoding of a point that is not of small order. A signature that fails this does not verify, whatever the platform's library would say. */
|
|
143
|
+
function ed25519SignatureIsStrict(signature) {
|
|
144
|
+
if (signature.length !== SIGNATURE_BYTES) return false;
|
|
145
|
+
const r = signature.subarray(0, PUBLIC_KEY_BYTES);
|
|
146
|
+
const s = signature.subarray(PUBLIC_KEY_BYTES);
|
|
147
|
+
const rY = encodedY(r);
|
|
148
|
+
return littleEndian(s) < GROUP_ORDER && rY < FIELD_PRIME && !SMALL_ORDER_Y.has(rY);
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
exports.ed25519KeyFault = ed25519KeyFault;
|
|
152
|
+
exports.ed25519SignatureIsStrict = ed25519SignatureIsStrict;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/domain/ed25519-identity-key.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* What an Ed25519 identity-key must be, and what an Ed25519 signature under one must look like, decided here and nowhere else, before the platform's crypto library is consulted.
|
|
4
|
+
*
|
|
5
|
+
* A key is usable when it is exactly 32 bytes, is the canonical encoding of a point on the curve (its y coordinate is below the field prime, and it decodes), is not a point of small order (the eight points of the torsion subgroup, the identity element among them), and lies in the prime-order subgroup (it has no torsion component). A signature is acceptable to verify when its S is below the group order and its R is a canonical encoding that is not a small-order point. The signature equation itself is the cofactorless one, `[S]B = R + [k]A` compared as encodings, which Web Crypto's Ed25519 verification does on the platforms the conformance vectors are run on: a platform that verifies differently fails the mixed-order vectors there. The Rust crates apply the same rules through ed25519-dalek's `is_weak`, `is_torsion_free` and `verify_strict`.
|
|
6
|
+
*/
|
|
7
|
+
/** Why a key is refused, in the order the checks run. */
|
|
8
|
+
export type Ed25519KeyFault = "wrong_size" | "non_canonical" | "not_a_point" | "small_order" | "mixed_order";
|
|
9
|
+
/** The first reason an Ed25519 identity-key's bytes are refused, or `undefined` for a usable key. The checks are independent of the platform's crypto library, and the verdict for a key is remembered (the least recently used first goes once more than a fixed number are held), so verifying many signatures under one key tests it for torsion once. */
|
|
10
|
+
export declare function ed25519KeyFault(publicKey: Uint8Array): Ed25519KeyFault | undefined;
|
|
11
|
+
/** Whether a 64-byte Ed25519 signature is acceptable to verify: S below the group order, and R a canonical encoding of a point that is not of small order. A signature that fails this does not verify, whatever the platform's library would say. */
|
|
12
|
+
export declare function ed25519SignatureIsStrict(signature: Uint8Array): boolean;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/domain/ed25519-identity-key.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* What an Ed25519 identity-key must be, and what an Ed25519 signature under one must look like, decided here and nowhere else, before the platform's crypto library is consulted.
|
|
4
|
+
*
|
|
5
|
+
* A key is usable when it is exactly 32 bytes, is the canonical encoding of a point on the curve (its y coordinate is below the field prime, and it decodes), is not a point of small order (the eight points of the torsion subgroup, the identity element among them), and lies in the prime-order subgroup (it has no torsion component). A signature is acceptable to verify when its S is below the group order and its R is a canonical encoding that is not a small-order point. The signature equation itself is the cofactorless one, `[S]B = R + [k]A` compared as encodings, which Web Crypto's Ed25519 verification does on the platforms the conformance vectors are run on: a platform that verifies differently fails the mixed-order vectors there. The Rust crates apply the same rules through ed25519-dalek's `is_weak`, `is_torsion_free` and `verify_strict`.
|
|
6
|
+
*/
|
|
7
|
+
/** Why a key is refused, in the order the checks run. */
|
|
8
|
+
export type Ed25519KeyFault = "wrong_size" | "non_canonical" | "not_a_point" | "small_order" | "mixed_order";
|
|
9
|
+
/** The first reason an Ed25519 identity-key's bytes are refused, or `undefined` for a usable key. The checks are independent of the platform's crypto library, and the verdict for a key is remembered (the least recently used first goes once more than a fixed number are held), so verifying many signatures under one key tests it for torsion once. */
|
|
10
|
+
export declare function ed25519KeyFault(publicKey: Uint8Array): Ed25519KeyFault | undefined;
|
|
11
|
+
/** Whether a 64-byte Ed25519 signature is acceptable to verify: S below the group order, and R a canonical encoding of a point that is not of small order. A signature that fails this does not verify, whatever the platform's library would say. */
|
|
12
|
+
export declare function ed25519SignatureIsStrict(signature: Uint8Array): boolean;
|
|
13
|
+
//#endregion
|