@libid/contracts 0.16.0 → 0.18.0

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 (106) hide show
  1. package/README.md +108 -47
  2. package/dist/abis/bindErrors.d.ts +714 -0
  3. package/dist/abis/bindErrors.d.ts.map +1 -0
  4. package/dist/abis/bindErrors.js +955 -0
  5. package/dist/abis/bindErrors.js.map +1 -0
  6. package/dist/abis/ceremonyPayloads.d.ts +118 -0
  7. package/dist/abis/ceremonyPayloads.d.ts.map +1 -0
  8. package/dist/abis/ceremonyPayloads.js +154 -0
  9. package/dist/abis/ceremonyPayloads.js.map +1 -0
  10. package/dist/abis/ceremonyProofVerifier.d.ts +6 -6
  11. package/dist/abis/ceremonyProofVerifier.js +6 -6
  12. package/dist/abis/ceremonyProofVerifier.js.map +1 -1
  13. package/dist/abis/handleEscrow.d.ts +56 -16
  14. package/dist/abis/handleEscrow.d.ts.map +1 -1
  15. package/dist/abis/handleEscrow.js +71 -19
  16. package/dist/abis/handleEscrow.js.map +1 -1
  17. package/dist/abis/honkVerifierErrors.d.ts +54 -0
  18. package/dist/abis/honkVerifierErrors.d.ts.map +1 -0
  19. package/dist/abis/honkVerifierErrors.js +71 -0
  20. package/dist/abis/honkVerifierErrors.js.map +1 -0
  21. package/dist/abis/identityRegistry.d.ts +123 -157
  22. package/dist/abis/identityRegistry.d.ts.map +1 -1
  23. package/dist/abis/identityRegistry.js +150 -194
  24. package/dist/abis/identityRegistry.js.map +1 -1
  25. package/dist/abis/index.d.ts +3 -0
  26. package/dist/abis/index.d.ts.map +1 -1
  27. package/dist/abis/index.js +3 -0
  28. package/dist/abis/index.js.map +1 -1
  29. package/dist/calls/handleEscrow.d.ts +1 -0
  30. package/dist/calls/handleEscrow.d.ts.map +1 -1
  31. package/dist/calls/handleEscrow.js +7 -0
  32. package/dist/calls/handleEscrow.js.map +1 -1
  33. package/dist/calls/identityRegistry.d.ts +2 -1
  34. package/dist/calls/identityRegistry.d.ts.map +1 -1
  35. package/dist/calls/identityRegistry.js +9 -2
  36. package/dist/calls/identityRegistry.js.map +1 -1
  37. package/dist/ceremony/profiles.d.ts +38 -48
  38. package/dist/ceremony/profiles.d.ts.map +1 -1
  39. package/dist/ceremony/profiles.js +31 -36
  40. package/dist/ceremony/profiles.js.map +1 -1
  41. package/dist/identity/index.d.ts +1 -2
  42. package/dist/identity/index.d.ts.map +1 -1
  43. package/dist/identity/index.js +5 -10
  44. package/dist/identity/index.js.map +1 -1
  45. package/dist/identity/node.d.ts +3 -3
  46. package/dist/identity/node.d.ts.map +1 -1
  47. package/dist/identity/node.js +25 -16
  48. package/dist/identity/node.js.map +1 -1
  49. package/dist/identity/resolve.d.ts +6 -8
  50. package/dist/identity/resolve.d.ts.map +1 -1
  51. package/dist/identity/resolve.js +54 -86
  52. package/dist/identity/resolve.js.map +1 -1
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +3 -4
  56. package/dist/index.js.map +1 -1
  57. package/dist/payloads.d.ts +124 -0
  58. package/dist/payloads.d.ts.map +1 -0
  59. package/dist/payloads.js +59 -0
  60. package/dist/payloads.js.map +1 -0
  61. package/dist/platforms/handle.d.ts +11 -0
  62. package/dist/platforms/handle.d.ts.map +1 -0
  63. package/dist/platforms/handle.js +29 -0
  64. package/dist/platforms/handle.js.map +1 -0
  65. package/dist/platforms/id.d.ts +8 -0
  66. package/dist/platforms/id.d.ts.map +1 -0
  67. package/dist/platforms/id.js +21 -0
  68. package/dist/platforms/id.js.map +1 -0
  69. package/dist/platforms/index.d.ts +4 -0
  70. package/dist/platforms/index.d.ts.map +1 -0
  71. package/dist/platforms/index.js +7 -0
  72. package/dist/platforms/index.js.map +1 -0
  73. package/dist/platforms/platforms.d.ts +39 -0
  74. package/dist/platforms/platforms.d.ts.map +1 -0
  75. package/dist/platforms/platforms.js +90 -0
  76. package/dist/platforms/platforms.js.map +1 -0
  77. package/package.json +8 -3
  78. package/src/abis/bindErrors.ts +957 -0
  79. package/src/abis/ceremonyPayloads.ts +156 -0
  80. package/src/abis/ceremonyProofVerifier.ts +6 -6
  81. package/src/abis/handleEscrow.ts +71 -19
  82. package/src/abis/honkVerifierErrors.ts +73 -0
  83. package/src/abis/identityRegistry.ts +150 -194
  84. package/src/abis/index.ts +3 -0
  85. package/src/calls/handleEscrow.ts +12 -0
  86. package/src/calls/identityRegistry.ts +14 -2
  87. package/src/ceremony/profiles.ts +53 -65
  88. package/src/identity/index.ts +5 -10
  89. package/src/identity/node.ts +25 -21
  90. package/src/identity/resolve.ts +72 -118
  91. package/src/index.ts +3 -4
  92. package/src/payloads.ts +90 -0
  93. package/src/platforms/handle.ts +36 -0
  94. package/src/platforms/id.ts +26 -0
  95. package/src/platforms/index.ts +7 -0
  96. package/src/platforms/platforms.ts +114 -0
  97. package/dist/identity/handle.d.ts +0 -22
  98. package/dist/identity/handle.d.ts.map +0 -1
  99. package/dist/identity/handle.js +0 -140
  100. package/dist/identity/handle.js.map +0 -1
  101. package/dist/identity/handleVectors.d.ts +0 -50
  102. package/dist/identity/handleVectors.d.ts.map +0 -1
  103. package/dist/identity/handleVectors.js +0 -89
  104. package/dist/identity/handleVectors.js.map +0 -1
  105. package/src/identity/handle.ts +0 -176
  106. package/src/identity/handleVectors.ts +0 -104
@@ -0,0 +1,90 @@
1
+ // Generated by scripts/regen-identity-handles.py. Do not edit.
2
+ // The sources are the pinned libID-circuits release's platforms.json and handles.json,
3
+ // vendored into solidity/contracts/circuits/ by scripts/vendor-circuit-verifiers.sh.
4
+ /** keccak256 of this string is the platform id. */
5
+ export const PLATFORM_GOOGLE_KEY = 'google';
6
+ /** keccak256 of this string is the platform id. */
7
+ export const PLATFORM_X_KEY = 'x';
8
+ /** keccak256 of this string is the platform id. */
9
+ export const PLATFORM_GITHUB_KEY = 'github';
10
+ export const PLATFORM_GOOGLE = {
11
+ key: PLATFORM_GOOGLE_KEY,
12
+ userIdTag: 'libid.google.user-id',
13
+ handleTag: 'libid.google.handle',
14
+ rules: {
15
+ maxLength: 62,
16
+ },
17
+ idRules: {
18
+ maxLength: 31,
19
+ decimal: false,
20
+ },
21
+ };
22
+ export const PLATFORM_X = {
23
+ key: PLATFORM_X_KEY,
24
+ userIdTag: 'libid.x.user-id',
25
+ handleTag: 'libid.x.handle',
26
+ rules: {
27
+ maxLength: 39,
28
+ },
29
+ idRules: {
30
+ maxLength: 20,
31
+ decimal: true,
32
+ },
33
+ };
34
+ export const PLATFORM_GITHUB = {
35
+ key: PLATFORM_GITHUB_KEY,
36
+ userIdTag: 'libid.github.user-id',
37
+ handleTag: 'libid.github.handle',
38
+ rules: {
39
+ maxLength: 39,
40
+ },
41
+ idRules: {
42
+ maxLength: 20,
43
+ decimal: true,
44
+ },
45
+ };
46
+ /** Every platform, in table order. */
47
+ export const PLATFORMS = [PLATFORM_GOOGLE, PLATFORM_X, PLATFORM_GITHUB];
48
+ /** The platform with this key, if the table names it. */
49
+ export function platform(key) {
50
+ return PLATFORMS.find((p) => p.key === key);
51
+ }
52
+ /** Why a handle was refused. */
53
+ export class HandleError extends Error {
54
+ kind;
55
+ constructor(kind) {
56
+ super(handleRefusal(kind));
57
+ this.kind = kind;
58
+ this.name = 'HandleError';
59
+ }
60
+ }
61
+ function handleRefusal(kind) {
62
+ switch (kind) {
63
+ case 'Empty':
64
+ return 'the handle is empty';
65
+ case 'TooLong':
66
+ return 'the handle is too long for this platform';
67
+ case 'BadCharacter':
68
+ return 'the handle has a byte outside printable ASCII, or a quote or backslash';
69
+ }
70
+ }
71
+ /** Why no circuit would hash an id. */
72
+ export class IdError extends Error {
73
+ kind;
74
+ constructor(kind) {
75
+ super(idRefusal(kind));
76
+ this.kind = kind;
77
+ this.name = 'IdError';
78
+ }
79
+ }
80
+ function idRefusal(kind) {
81
+ switch (kind) {
82
+ case 'Empty':
83
+ return 'the id is empty';
84
+ case 'TooLong':
85
+ return 'the id is too long for this platform';
86
+ case 'BadCharacter':
87
+ return 'the id has a byte this platform does not allow';
88
+ }
89
+ }
90
+ //# sourceMappingURL=platforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../src/platforms/platforms.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,uFAAuF;AACvF,qFAAqF;AAoBrF,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAA;AAC3C,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AACjC,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAA;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,GAAG,EAAE,mBAAmB;IACxB,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAE,qBAAqB;IAChC,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;KACd;IACD,OAAO,EAAE;QACP,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,KAAK;KACf;CACF,CAAA;AACD,MAAM,CAAC,MAAM,UAAU,GAAa;IAClC,GAAG,EAAE,cAAc;IACnB,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;KACd;IACD,OAAO,EAAE;QACP,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,IAAI;KACd;CACF,CAAA;AACD,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,GAAG,EAAE,mBAAmB;IACxB,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAE,qBAAqB;IAChC,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;KACd;IACD,OAAO,EAAE;QACP,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,IAAI;KACd;CACF,CAAA;AAED,sCAAsC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAwB,CAAC,eAAe,EAAE,UAAU,EAAE,eAAe,CAAC,CAAA;AAE5F,yDAAyD;AACzD,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAA;AAC7C,CAAC;AAKD,gCAAgC;AAChC,MAAM,OAAO,WAAY,SAAQ,KAAK;IACf;IAArB,YAAqB,IAAiB;QACpC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;QADP,SAAI,GAAJ,IAAI,CAAa;QAEpC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AAED,SAAS,aAAa,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,OAAO;YACV,OAAO,qBAAqB,CAAA;QAC9B,KAAK,SAAS;YACZ,OAAO,0CAA0C,CAAA;QACnD,KAAK,cAAc;YACjB,OAAO,wEAAwE,CAAA;IACnF,CAAC;AACH,CAAC;AAED,uCAAuC;AACvC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IACX;IAArB,YAAqB,IAAiB;QACpC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;QADH,SAAI,GAAJ,IAAI,CAAa;QAEpC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;IACvB,CAAC;CACF;AAED,SAAS,SAAS,CAAC,IAAiB;IAClC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,OAAO;YACV,OAAO,iBAAiB,CAAA;QAC1B,KAAK,SAAS;YACZ,OAAO,sCAAsC,CAAA;QAC/C,KAAK,cAAc;YACjB,OAAO,gDAAgD,CAAA;IAC3D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libid/contracts",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
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": {
@@ -15,7 +15,8 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "src",
18
- "!src/**/*.test.ts"
18
+ "!src/**/*.test.ts",
19
+ "!src/platforms/vectors.ts"
19
20
  ],
20
21
  "exports": {
21
22
  ".": {
@@ -30,6 +31,10 @@
30
31
  "types": "./dist/ceremony/index.d.ts",
31
32
  "default": "./dist/ceremony/index.js"
32
33
  },
34
+ "./platforms": {
35
+ "types": "./dist/platforms/index.d.ts",
36
+ "default": "./dist/platforms/index.js"
37
+ },
33
38
  "./identity": {
34
39
  "types": "./dist/identity/index.d.ts",
35
40
  "default": "./dist/identity/index.js"
@@ -52,7 +57,7 @@
52
57
  "tsx": "^4.20.0",
53
58
  "typescript": "^5.9.0",
54
59
  "viem": "^2.48.11",
55
- "vitest": "^3.2.0"
60
+ "vitest": "^4.1.11"
56
61
  },
57
62
  "scripts": {
58
63
  "codegen": "node scripts/codegen.mjs",