@johnhenry/browsermesh-primitives 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. package/package.json +7 -2
  2. package/src/index.d.ts +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnhenry/browsermesh-primitives",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Shared primitives for browser mesh networking — wire format, identity (Ed25519), CRDTs, capabilities, trust model, and ACL engine",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
@@ -32,7 +32,12 @@
32
32
  },
33
33
  "homepage": "https://opensource.johnhenry.me/browsermesh/",
34
34
  "scripts": {
35
- "test": "node --test test/*.test.mjs"
35
+ "pretest": "npm run typecheck",
36
+ "test": "node --test test/*.test.mjs",
37
+ "typecheck": "tsc --noEmit -p test/tsconfig.json"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "^7.0.2"
36
41
  },
37
42
  "engines": {
38
43
  "node": ">=26.0.0"
package/src/index.d.ts CHANGED
@@ -19,6 +19,24 @@ export declare function encodeBase64url(bytes: Uint8Array): string;
19
19
  export declare function decodeBase64url(str: string): Uint8Array;
20
20
  export declare function derivePodId(publicKey: CryptoKey): Promise<string>;
21
21
 
22
+ /**
23
+ * Probe for WebCrypto Ed25519 support by asking for a key. Resolves true or
24
+ * false, never throws, and caches the answer. Call this before
25
+ * `PodIdentity.generate()` if you need to degrade gracefully rather than
26
+ * catch a NotSupportedError from four frames down.
27
+ */
28
+ export declare function probeEd25519Support(): Promise<boolean>;
29
+
30
+ /**
31
+ * Cached answer from `probeEd25519Support()`, or `null` when the probe has
32
+ * not resolved yet. Treat `null` as "unknown"; await `probeEd25519Support()`
33
+ * for a definite answer.
34
+ */
35
+ export declare function supportsEd25519(): boolean | null;
36
+
37
+ /** Reset the cached Ed25519 probe. Tests only. */
38
+ export declare function _resetEd25519Probe(): void;
39
+
22
40
  export declare class PodIdentity {
23
41
  keyPair: CryptoKeyPair;
24
42
  podId: string;