@libid/contracts 0.18.0 → 0.18.1

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/README.md CHANGED
@@ -170,10 +170,10 @@ omits. `honkVerifierErrorsAbi` declares them under bb's names, and
170
170
 
171
171
  ## Normalizing a handle locally
172
172
 
173
- `@libid/contracts/platforms` holds the platform table and the checks the
174
- circuits apply to handles and ids, and loads without viem.
175
- `@libid/contracts/identity` re-exports it and adds node hashing and the
176
- registry reads, which need viem.
173
+ `@libid/contracts/platforms` holds the platform table, the checks the
174
+ circuits apply to handles and ids, and node derivation, and loads without viem.
175
+ `@libid/contracts/identity` re-exports it and adds the registry reads, which
176
+ need viem.
177
177
 
178
178
  Only A–Z fold to a–z. Text no circuit hashes throws
179
179
  `HandleError`: empty text, a byte outside printable ASCII, a quote, a
@@ -199,7 +199,7 @@ the user-id tag. Nodes are unsalted, so anyone can test a guess against one.
199
199
  Both functions take the platform key, not its id:
200
200
 
201
201
  ```ts
202
- import { checkId, handleNode, idNode, PLATFORM_GOOGLE_KEY } from '@libid/contracts/identity'
202
+ import { checkId, handleNode, idNode, PLATFORM_GOOGLE_KEY } from '@libid/contracts/platforms'
203
203
 
204
204
  // HandleEscrow.deposit, handleBinding, escrowed, claim, refund
205
205
  const node = handleNode(PLATFORM_GOOGLE_KEY, 'Alice@Gmail.com')
@@ -1,4 +1,3 @@
1
1
  export * from '../platforms/index.js';
2
- export * from './node.js';
3
2
  export * from './resolve.js';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA"}
@@ -4,6 +4,5 @@
4
4
  /// Normalization applies the token check and the fold the circuits enforce;
5
5
  /// the chain only folds A-Z. Calldata for the writes is in `../calls`.
6
6
  export * from '../platforms/index.js';
7
- export * from './node.js';
8
7
  export * from './resolve.js';
9
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sCAAsC;AACtC,GAAG;AACH,4EAA4E;AAC5E,uEAAuE;AAEvE,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sCAAsC;AACtC,GAAG;AACH,4EAA4E;AAC5E,uEAAuE;AAEvE,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/identity/resolve.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAa,KAAK,YAAY,EAAgC,MAAM,MAAM,CAAA;AAQ/F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,KAAK,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,CAAA;AAI/E,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,EAAE,CAEvF;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,YAAY,CAAA;IAEpB,OAAO,EAAE,OAAO,CAAA;CACjB;AAuBD,wBAAsB,SAAS,CAC7B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,KAAK,MAAM,EAAE,GACpB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAGzB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sB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5F;AAID,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,QAAQ,EAAE,CAAC,CAQrB"}
@@ -4,8 +4,7 @@
4
4
  /// no network configuration.
5
5
  import { keccak256, toHex, zeroAddress, zeroHash } from 'viem';
6
6
  import { identityRegistryAbi } from '../abis/identityRegistry.js';
7
- import { HandleError, PLATFORMS } from '../platforms/index.js';
8
- import { handleNode } from './node.js';
7
+ import { HandleError, handleNode, PLATFORMS } from '../platforms/index.js';
9
8
  /// A platform id is `keccak256` of its platform key, as `CeremonyProfile`
10
9
  /// derives it.
11
10
  export function platformId(platformKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/identity/resolve.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,GAAG;AACH,8EAA8E;AAC9E,6BAA6B;AAE7B,OAAO,EAAgB,SAAS,EAAqB,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAMtC,0EAA0E;AAC1E,eAAe;AACf,MAAM,UAAU,UAAU,CAAmB,WAA2B;IACtE,OAAO,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;AACtC,CAAC;AAQD,+EAA+E;AAC/E,iFAAiF;AACjF,SAAS,IAAI,CACX,MAAsB,EACtB,YAAoB,EACpB,IAAwB;IAExB,OACE,MAAM,CAAC,MAGR,CAAC,YAAY,CAAC;QACb,iBAAi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,gCAAgC;AAChC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAsB,EACtB,UAAyB,EACzB,MAAc;IAEd,OAAO,CAAC,MAAM,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;AAChF,CAAC;AAED,yEAAyE;AACzE,yDAAyD;AACzD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAsB,EACtB,MAAe,EACf,UAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAS,MAAM,EAAE,mBAAmB,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;IACpF,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;AAC5C,CAAC;AAcD,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAsB,EAAE,MAAe;IACzE,OAAO,IAAI,CAAS,MAAM,EAAE,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AACxD,CAAC;AAED,mFAAmF;AACnF,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAsB,EACtB,MAAe,EACf,IAAY,EACZ,KAAa;IAEb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAsB,MAAM,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAC3F,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACtE,UAAU;QACV,MAAM;QACN,UAAU;QACV,aAAa;KACd,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './handle.js';
2
2
  export * from './id.js';
3
+ export * from './node.js';
3
4
  export * from './platforms.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
@@ -1,7 +1,8 @@
1
- /// The platform table and the checks the identity circuits apply to handles
2
- /// and ids: normalization, the id check and the refusals they throw. Loads
3
- /// without viem; node hashing and the registry reads are in `../identity`.
1
+ /// The platform table, the checks the identity circuits apply to handles and
2
+ /// ids (normalization, the id check and the refusals they throw) and the node
3
+ /// derivation. Loads without viem; the registry reads are in `../identity`.
4
4
  export * from './handle.js';
5
5
  export * from './id.js';
6
+ export * from './node.js';
6
7
  export * from './platforms.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAE3E,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAE5E,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
@@ -1,5 +1,4 @@
1
- import { type Hex } from 'viem';
2
- export declare function handleNode(platformKey: string, raw: string): Hex;
3
- export declare function foldedHandleNode(platformKey: string, text: string): Hex;
4
- export declare function idNode(platformKey: string, id: string): Hex;
1
+ export declare function handleNode(platformKey: string, raw: string): `0x${string}`;
2
+ export declare function foldedHandleNode(platformKey: string, text: string): `0x${string}`;
3
+ export declare function idNode(platformKey: string, id: string): `0x${string}`;
5
4
  //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/platforms/node.ts"],"names":[],"mappings":"AAuBA,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAG1E;AAID,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAGjF;AAID,wBAAgB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAGrE"}
@@ -1,28 +1,36 @@
1
1
  /// The keys a binding is stored under, `SHA256(tag || value)`, computed
2
2
  /// locally so the handle or id never reaches an RPC.
3
- import { concat, sha256, toHex } from 'viem';
4
- import { checkId, normalize, platform } from '../platforms/index.js';
3
+ import { sha256 } from '@noble/hashes/sha2.js';
4
+ import { bytesToHex, concatBytes, utf8ToBytes } from '@noble/hashes/utils.js';
5
+ import { normalize } from './handle.js';
6
+ import { checkId } from './id.js';
7
+ import { platform } from './platforms.js';
5
8
  function keysOf(platformKey) {
6
9
  const keys = platform(platformKey);
7
10
  if (keys === undefined)
8
11
  throw new Error(`unknown platform ${JSON.stringify(platformKey)}`);
9
12
  return keys;
10
13
  }
14
+ /// `SHA256(tag || value)` as lowercase `0x` hex.
15
+ function nodeOf(tag, value) {
16
+ return `0x${bytesToHex(sha256(concatBytes(utf8ToBytes(tag), value)))}`;
17
+ }
11
18
  /// The node a typed handle is bound under: normalized, then hashed under
12
19
  /// its handle tag. Throws `HandleError` for text no binding can have.
13
20
  export function handleNode(platformKey, raw) {
14
21
  const keys = keysOf(platformKey);
15
- return sha256(concat([toHex(keys.handleTag), toHex(normalize(raw, keys.rules))]));
22
+ return nodeOf(keys.handleTag, utf8ToBytes(normalize(raw, keys.rules)));
16
23
  }
17
24
  /// The node `depositToHandle` and the registry's `handleNodeOf` derive from
18
25
  /// `text`: A-Z folded, nothing checked, so text no circuit hashes has one too.
19
26
  export function foldedHandleNode(platformKey, text) {
20
- const bytes = new TextEncoder().encode(text).map((b) => (b >= 0x41 && b <= 0x5a ? b + 0x20 : b));
21
- return sha256(concat([toHex(keysOf(platformKey).handleTag), toHex(bytes)]));
27
+ const bytes = utf8ToBytes(text).map((b) => (b >= 0x41 && b <= 0x5a ? b + 0x20 : b));
28
+ return nodeOf(keysOf(platformKey).handleTag, bytes);
22
29
  }
23
30
  /// The node an id is bound under: the id as given, under its user-id tag.
31
+ /// Throws `IdError` for an id no circuit hashes.
24
32
  export function idNode(platformKey, id) {
25
33
  checkId(platformKey, id);
26
- return sha256(concat([toHex(keysOf(platformKey).userIdTag), toHex(id)]));
34
+ return nodeOf(keysOf(platformKey).userIdTag, utf8ToBytes(id));
27
35
  }
28
36
  //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/platforms/node.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qDAAqD;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAiB,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAExD,SAAS,MAAM,CAAC,WAAmB;IACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;IAClC,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAA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6 @@
1
1
  {
2
2
  "name": "@libid/contracts",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Typed viem-ready ABIs and call builders for the libid contracts, plus the identity helper layer (handle normalization, handle resolution).",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "repository": {
@@ -44,6 +44,9 @@
44
44
  "default": "./dist/calls/index.js"
45
45
  }
46
46
  },
47
+ "dependencies": {
48
+ "@noble/hashes": "^1.8.0 || ^2.0.0"
49
+ },
47
50
  "peerDependencies": {
48
51
  "viem": "^2.48.11"
49
52
  },
@@ -5,5 +5,4 @@
5
5
  /// the chain only folds A-Z. Calldata for the writes is in `../calls`.
6
6
 
7
7
  export * from '../platforms/index.js'
8
- export * from './node.js'
9
8
  export * from './resolve.js'
@@ -6,8 +6,7 @@
6
6
  import { type Address, keccak256, type PublicClient, toHex, zeroAddress, zeroHash } from 'viem'
7
7
 
8
8
  import { identityRegistryAbi } from '../abis/identityRegistry.js'
9
- import { HandleError, PLATFORMS } from '../platforms/index.js'
10
- import { handleNode } from './node.js'
9
+ import { HandleError, handleNode, PLATFORMS } from '../platforms/index.js'
11
10
 
12
11
  /// A platform key (`'x'`, `'github'`, ...). A value typed as hex fails to
13
12
  /// compile: an id passed as a key would hash into a platform nothing binds.
@@ -1,7 +1,8 @@
1
- /// The platform table and the checks the identity circuits apply to handles
2
- /// and ids: normalization, the id check and the refusals they throw. Loads
3
- /// without viem; node hashing and the registry reads are in `../identity`.
1
+ /// The platform table, the checks the identity circuits apply to handles and
2
+ /// ids (normalization, the id check and the refusals they throw) and the node
3
+ /// derivation. Loads without viem; the registry reads are in `../identity`.
4
4
 
5
5
  export * from './handle.js'
6
6
  export * from './id.js'
7
+ export * from './node.js'
7
8
  export * from './platforms.js'
@@ -0,0 +1,41 @@
1
+ /// The keys a binding is stored under, `SHA256(tag || value)`, computed
2
+ /// locally so the handle or id never reaches an RPC.
3
+
4
+ import { sha256 } from '@noble/hashes/sha2.js'
5
+ import { bytesToHex, concatBytes, utf8ToBytes } from '@noble/hashes/utils.js'
6
+
7
+ import { normalize } from './handle.js'
8
+ import { checkId } from './id.js'
9
+ import { type Platform, platform } from './platforms.js'
10
+
11
+ function keysOf(platformKey: string): Platform {
12
+ const keys = platform(platformKey)
13
+ if (keys === undefined) throw new Error(`unknown platform ${JSON.stringify(platformKey)}`)
14
+ return keys
15
+ }
16
+
17
+ /// `SHA256(tag || value)` as lowercase `0x` hex.
18
+ function nodeOf(tag: string, value: Uint8Array): `0x${string}` {
19
+ return `0x${bytesToHex(sha256(concatBytes(utf8ToBytes(tag), value)))}`
20
+ }
21
+
22
+ /// The node a typed handle is bound under: normalized, then hashed under
23
+ /// its handle tag. Throws `HandleError` for text no binding can have.
24
+ export function handleNode(platformKey: string, raw: string): `0x${string}` {
25
+ const keys = keysOf(platformKey)
26
+ return nodeOf(keys.handleTag, utf8ToBytes(normalize(raw, keys.rules)))
27
+ }
28
+
29
+ /// The node `depositToHandle` and the registry's `handleNodeOf` derive from
30
+ /// `text`: A-Z folded, nothing checked, so text no circuit hashes has one too.
31
+ export function foldedHandleNode(platformKey: string, text: string): `0x${string}` {
32
+ const bytes = utf8ToBytes(text).map((b) => (b >= 0x41 && b <= 0x5a ? b + 0x20 : b))
33
+ return nodeOf(keysOf(platformKey).handleTag, bytes)
34
+ }
35
+
36
+ /// The node an id is bound under: the id as given, under its user-id tag.
37
+ /// Throws `IdError` for an id no circuit hashes.
38
+ export function idNode(platformKey: string, id: string): `0x${string}` {
39
+ checkId(platformKey, id)
40
+ return nodeOf(keysOf(platformKey).userIdTag, utf8ToBytes(id))
41
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/identity/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,GAAG,EAAiB,MAAM,MAAM,CAAA;AAYtD,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAGhE;AAID,wB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AC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7E,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,MAAM,CAAC,WAAmB,EAAE,EAAU;IACpD,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IACxB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC"}
@@ -1,32 +0,0 @@
1
- /// The keys a binding is stored under, `SHA256(tag || value)`, computed
2
- /// locally so the handle or id never reaches an RPC.
3
-
4
- import { concat, type Hex, sha256, toHex } from 'viem'
5
-
6
- import { checkId, normalize, type Platform, platform } from '../platforms/index.js'
7
-
8
- function keysOf(platformKey: string): Platform {
9
- const keys = platform(platformKey)
10
- if (keys === undefined) throw new Error(`unknown platform ${JSON.stringify(platformKey)}`)
11
- return keys
12
- }
13
-
14
- /// The node a typed handle is bound under: normalized, then hashed under
15
- /// its handle tag. Throws `HandleError` for text no binding can have.
16
- export function handleNode(platformKey: string, raw: string): Hex {
17
- const keys = keysOf(platformKey)
18
- return sha256(concat([toHex(keys.handleTag), toHex(normalize(raw, keys.rules))]))
19
- }
20
-
21
- /// The node `depositToHandle` and the registry's `handleNodeOf` derive from
22
- /// `text`: A-Z folded, nothing checked, so text no circuit hashes has one too.
23
- export function foldedHandleNode(platformKey: string, text: string): Hex {
24
- const bytes = new TextEncoder().encode(text).map((b) => (b >= 0x41 && b <= 0x5a ? b + 0x20 : b))
25
- return sha256(concat([toHex(keysOf(platformKey).handleTag), toHex(bytes)]))
26
- }
27
-
28
- /// The node an id is bound under: the id as given, under its user-id tag.
29
- export function idNode(platformKey: string, id: string): Hex {
30
- checkId(platformKey, id)
31
- return sha256(concat([toHex(keysOf(platformKey).userIdTag), toHex(id)]))
32
- }