@certen.io/sdk 0.5.0 → 0.7.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +599 -0
  2. package/README.md +133 -119
  3. package/dist/client.d.ts +96 -6
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +258 -20
  6. package/dist/client.js.map +1 -1
  7. package/dist/doctor.d.ts +53 -0
  8. package/dist/doctor.d.ts.map +1 -0
  9. package/dist/doctor.js +451 -0
  10. package/dist/doctor.js.map +1 -0
  11. package/dist/error-codes.d.ts +14 -0
  12. package/dist/error-codes.d.ts.map +1 -0
  13. package/dist/error-codes.js +55 -0
  14. package/dist/error-codes.js.map +1 -0
  15. package/dist/errors.d.ts +13 -1
  16. package/dist/errors.d.ts.map +1 -1
  17. package/dist/errors.js +18 -1
  18. package/dist/errors.js.map +1 -1
  19. package/dist/funding.d.ts +43 -0
  20. package/dist/funding.d.ts.map +1 -0
  21. package/dist/funding.js +116 -0
  22. package/dist/funding.js.map +1 -0
  23. package/dist/index.d.ts +10 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +19 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/oauth.d.ts +56 -0
  28. package/dist/oauth.d.ts.map +1 -0
  29. package/dist/oauth.js +68 -0
  30. package/dist/oauth.js.map +1 -0
  31. package/dist/registration.d.ts +33 -0
  32. package/dist/registration.d.ts.map +1 -0
  33. package/dist/registration.js +49 -0
  34. package/dist/registration.js.map +1 -0
  35. package/dist/resources/admin.d.ts +52 -1
  36. package/dist/resources/admin.d.ts.map +1 -1
  37. package/dist/resources/admin.js +55 -0
  38. package/dist/resources/admin.js.map +1 -1
  39. package/dist/resources/billing.d.ts +198 -19
  40. package/dist/resources/billing.d.ts.map +1 -1
  41. package/dist/resources/billing.js +297 -7
  42. package/dist/resources/billing.js.map +1 -1
  43. package/dist/resources/chains.d.ts +38 -0
  44. package/dist/resources/chains.d.ts.map +1 -0
  45. package/dist/resources/chains.js +46 -0
  46. package/dist/resources/chains.js.map +1 -0
  47. package/dist/resources/device.d.ts +43 -0
  48. package/dist/resources/device.d.ts.map +1 -0
  49. package/dist/resources/device.js +49 -0
  50. package/dist/resources/device.js.map +1 -0
  51. package/dist/resources/execute.d.ts +10 -0
  52. package/dist/resources/execute.d.ts.map +1 -1
  53. package/dist/resources/execute.js +28 -6
  54. package/dist/resources/execute.js.map +1 -1
  55. package/dist/resources/health.d.ts +34 -0
  56. package/dist/resources/health.d.ts.map +1 -0
  57. package/dist/resources/health.js +43 -0
  58. package/dist/resources/health.js.map +1 -0
  59. package/dist/resources/identity.d.ts +83 -2
  60. package/dist/resources/identity.d.ts.map +1 -1
  61. package/dist/resources/identity.js +154 -2
  62. package/dist/resources/identity.js.map +1 -1
  63. package/dist/resources/oauth-clients.d.ts +71 -0
  64. package/dist/resources/oauth-clients.d.ts.map +1 -0
  65. package/dist/resources/oauth-clients.js +75 -0
  66. package/dist/resources/oauth-clients.js.map +1 -0
  67. package/dist/resources/pending.d.ts +13 -1
  68. package/dist/resources/pending.d.ts.map +1 -1
  69. package/dist/resources/pending.js +15 -0
  70. package/dist/resources/pending.js.map +1 -1
  71. package/dist/resources/proof.d.ts +82 -0
  72. package/dist/resources/proof.d.ts.map +1 -0
  73. package/dist/resources/proof.js +112 -0
  74. package/dist/resources/proof.js.map +1 -0
  75. package/dist/resources/registration-tokens.d.ts +51 -0
  76. package/dist/resources/registration-tokens.d.ts.map +1 -0
  77. package/dist/resources/registration-tokens.js +54 -0
  78. package/dist/resources/registration-tokens.js.map +1 -0
  79. package/dist/resources/sign.d.ts.map +1 -1
  80. package/dist/resources/sign.js +12 -7
  81. package/dist/resources/sign.js.map +1 -1
  82. package/dist/resources/transaction.d.ts +20 -0
  83. package/dist/resources/transaction.d.ts.map +1 -1
  84. package/dist/resources/transaction.js +28 -0
  85. package/dist/resources/transaction.js.map +1 -1
  86. package/dist/resources/transparency.d.ts +68 -0
  87. package/dist/resources/transparency.d.ts.map +1 -0
  88. package/dist/resources/transparency.js +83 -0
  89. package/dist/resources/transparency.js.map +1 -0
  90. package/dist/resources/webhooks.d.ts +97 -0
  91. package/dist/resources/webhooks.d.ts.map +1 -0
  92. package/dist/resources/webhooks.js +112 -0
  93. package/dist/resources/webhooks.js.map +1 -0
  94. package/dist/self-signup.d.ts +66 -0
  95. package/dist/self-signup.d.ts.map +1 -0
  96. package/dist/self-signup.js +76 -0
  97. package/dist/self-signup.js.map +1 -0
  98. package/dist/shared-proof.d.ts +34 -0
  99. package/dist/shared-proof.d.ts.map +1 -0
  100. package/dist/shared-proof.js +78 -0
  101. package/dist/shared-proof.js.map +1 -0
  102. package/dist/sign-target.d.ts +34 -0
  103. package/dist/sign-target.d.ts.map +1 -0
  104. package/dist/sign-target.js +41 -0
  105. package/dist/sign-target.js.map +1 -0
  106. package/dist/types.d.ts +831 -22
  107. package/dist/types.d.ts.map +1 -1
  108. package/dist/verify-receipt.d.ts +32 -0
  109. package/dist/verify-receipt.d.ts.map +1 -0
  110. package/dist/verify-receipt.js +176 -0
  111. package/dist/verify-receipt.js.map +1 -0
  112. package/package.json +4 -3
@@ -0,0 +1,38 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import type { ChainsListResponse, ChainDetailResponse } from '../types.js';
3
+ /**
4
+ * The contract registry: which chains CERTEN is deployed on, and at what addresses.
5
+ *
6
+ * **These two endpoints are public.** They take no API key, by deliberate design on the gateway
7
+ * side — someone deciding whether to build on CERTEN needs to see the on-chain footprint before
8
+ * they have a credential, and an address already published on eight block explorers is not a
9
+ * secret worth gating. Calls made through this resource still carry the client's key header;
10
+ * the gateway simply does not require it.
11
+ *
12
+ * That property is what lets a CLI validate a chain name, or check that the gateway is alive,
13
+ * before the user has logged in to anything.
14
+ */
15
+ export declare class ChainsResource {
16
+ private http;
17
+ constructor(http: AxiosInstance);
18
+ /**
19
+ * Every network in the registry, with contract addresses and explorer links.
20
+ *
21
+ * `verifiedOnly` filters to networks whose contracts were all confirmed to carry bytecode via
22
+ * `eth_getCode`. Non-EVM entries are transcribed from validator configuration and are never
23
+ * independently verified, so they do not survive that filter — which is the honest behaviour,
24
+ * not an omission.
25
+ */
26
+ list(params?: {
27
+ family?: string;
28
+ verifiedOnly?: boolean;
29
+ }): Promise<ChainsListResponse>;
30
+ /**
31
+ * One network, by registry id (`base-sepolia`) or numeric EVM chain id (`84532`).
32
+ *
33
+ * Both spellings are accepted because integrators have whichever one their wallet or RPC config
34
+ * handed them, and making them translate is a step that buys nothing.
35
+ */
36
+ get(idOrChainId: string | number): Promise<ChainDetailResponse>;
37
+ }
38
+ //# sourceMappingURL=chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/resources/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEvC;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUjG;;;;;OAKG;IACG,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAItE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The contract registry: which chains CERTEN is deployed on, and at what addresses.
3
+ *
4
+ * **These two endpoints are public.** They take no API key, by deliberate design on the gateway
5
+ * side — someone deciding whether to build on CERTEN needs to see the on-chain footprint before
6
+ * they have a credential, and an address already published on eight block explorers is not a
7
+ * secret worth gating. Calls made through this resource still carry the client's key header;
8
+ * the gateway simply does not require it.
9
+ *
10
+ * That property is what lets a CLI validate a chain name, or check that the gateway is alive,
11
+ * before the user has logged in to anything.
12
+ */
13
+ export class ChainsResource {
14
+ http;
15
+ constructor(http) {
16
+ this.http = http;
17
+ }
18
+ /**
19
+ * Every network in the registry, with contract addresses and explorer links.
20
+ *
21
+ * `verifiedOnly` filters to networks whose contracts were all confirmed to carry bytecode via
22
+ * `eth_getCode`. Non-EVM entries are transcribed from validator configuration and are never
23
+ * independently verified, so they do not survive that filter — which is the honest behaviour,
24
+ * not an omission.
25
+ */
26
+ async list(params = {}) {
27
+ const { data } = await this.http.get('/v1/chains', {
28
+ params: {
29
+ family: params.family,
30
+ verified_only: params.verifiedOnly,
31
+ },
32
+ });
33
+ return data;
34
+ }
35
+ /**
36
+ * One network, by registry id (`base-sepolia`) or numeric EVM chain id (`84532`).
37
+ *
38
+ * Both spellings are accepted because integrators have whichever one their wallet or RPC config
39
+ * handed them, and making them translate is a step that buys nothing.
40
+ */
41
+ async get(idOrChainId) {
42
+ const { data } = await this.http.get(`/v1/chains/${idOrChainId}`);
43
+ return data;
44
+ }
45
+ }
46
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/resources/chains.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAE3C;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,SAAsD,EAAE;QACjE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE;YACjD,MAAM,EAAE;gBACN,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,aAAa,EAAE,MAAM,CAAC,YAAY;aACnC;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,WAA4B;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,WAAW,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import type { DeviceAuthorization, DeviceAuthorizationStatus } from '../types.js';
3
+ /**
4
+ * The device authorization grant (RFC 8628), so a terminal can obtain its own API key.
5
+ *
6
+ * Without it, the first credential could only be minted in a browser and carried to a terminal by
7
+ * hand — several steps in another application, and a long-lived secret through a clipboard and
8
+ * usually into shell history.
9
+ *
10
+ * **`start` and `poll` take no API key**, by design: the caller has none yet, which is the entire
11
+ * point. Neither grants anything on its own. A started request belongs to no organization until a
12
+ * signed-in owner or admin approves it in the portal, and the key is minted only when the device
13
+ * collects it — once — using the 256-bit device code, which the gateway stores only as an HMAC.
14
+ *
15
+ * Approval and denial are **not** exposed here. They require a Firebase portal session, which a
16
+ * machine key deliberately cannot substitute for: the gateway answers 401 to an approval attempt
17
+ * carrying `X-API-Key`, so a leaked machine key cannot escalate itself into minting more keys.
18
+ * Putting those calls on this SDK would imply otherwise.
19
+ */
20
+ export declare class DeviceResource {
21
+ private http;
22
+ constructor(http: AxiosInstance);
23
+ /**
24
+ * Ask for a device code and the short user code a human types into the portal.
25
+ *
26
+ * `deviceName` is shown on the approval screen and becomes the minted key's name, so make it
27
+ * something the approver will recognise as the machine in front of them.
28
+ */
29
+ start(params?: {
30
+ deviceName?: string;
31
+ }): Promise<DeviceAuthorization>;
32
+ /**
33
+ * Ask whether it has been approved yet, and collect the key when it has.
34
+ *
35
+ * **The key is returned exactly once**, in the first response after approval; later calls report
36
+ * `claimed` and carry nothing. Store it before doing anything else with the result.
37
+ *
38
+ * Poll no faster than the `interval` seconds `start` returned. A `claimed` status on a code this
39
+ * process never collected means someone else did — worth surfacing loudly rather than retrying.
40
+ */
41
+ poll(deviceCode: string): Promise<DeviceAuthorizationStatus>;
42
+ }
43
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/resources/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAElF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEvC;;;;;OAKG;IACG,KAAK,CAAC,MAAM,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/E;;;;;;;;OAQG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAInE"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The device authorization grant (RFC 8628), so a terminal can obtain its own API key.
3
+ *
4
+ * Without it, the first credential could only be minted in a browser and carried to a terminal by
5
+ * hand — several steps in another application, and a long-lived secret through a clipboard and
6
+ * usually into shell history.
7
+ *
8
+ * **`start` and `poll` take no API key**, by design: the caller has none yet, which is the entire
9
+ * point. Neither grants anything on its own. A started request belongs to no organization until a
10
+ * signed-in owner or admin approves it in the portal, and the key is minted only when the device
11
+ * collects it — once — using the 256-bit device code, which the gateway stores only as an HMAC.
12
+ *
13
+ * Approval and denial are **not** exposed here. They require a Firebase portal session, which a
14
+ * machine key deliberately cannot substitute for: the gateway answers 401 to an approval attempt
15
+ * carrying `X-API-Key`, so a leaked machine key cannot escalate itself into minting more keys.
16
+ * Putting those calls on this SDK would imply otherwise.
17
+ */
18
+ export class DeviceResource {
19
+ http;
20
+ constructor(http) {
21
+ this.http = http;
22
+ }
23
+ /**
24
+ * Ask for a device code and the short user code a human types into the portal.
25
+ *
26
+ * `deviceName` is shown on the approval screen and becomes the minted key's name, so make it
27
+ * something the approver will recognise as the machine in front of them.
28
+ */
29
+ async start(params = {}) {
30
+ const { data } = await this.http.post('/v1/portal/device', {
31
+ device_name: params.deviceName,
32
+ });
33
+ return data;
34
+ }
35
+ /**
36
+ * Ask whether it has been approved yet, and collect the key when it has.
37
+ *
38
+ * **The key is returned exactly once**, in the first response after approval; later calls report
39
+ * `claimed` and carry nothing. Store it before doing anything else with the result.
40
+ *
41
+ * Poll no faster than the `interval` seconds `start` returned. A `claimed` status on a code this
42
+ * process never collected means someone else did — worth surfacing loudly rather than retrying.
43
+ */
44
+ async poll(deviceCode) {
45
+ const { data } = await this.http.get(`/v1/portal/device/${encodeURIComponent(deviceCode)}`);
46
+ return data;
47
+ }
48
+ }
49
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/resources/device.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAE3C;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,SAAkC,EAAE;QAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YACzD,WAAW,EAAE,MAAM,CAAC,UAAU;SAC/B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,CAAC,UAAkB;QAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -44,6 +44,14 @@ export interface ProofGatedCallParams {
44
44
  */
45
45
  proofClass?: ProofClass;
46
46
  idempotencyKey?: string;
47
+ /**
48
+ * Submit even if the abstract account is known to hold no gas.
49
+ *
50
+ * The guard refuses only on a POSITIVELY OBSERVED zero balance, because an intent that moves
51
+ * value from an empty account is accepted, signed, submitted, and then parks at `anchoring`
52
+ * forever with nothing reporting why. Set this when you are deliberately exercising that path.
53
+ */
54
+ skipFundingCheck?: boolean;
47
55
  }
48
56
  export interface TransferParams {
49
57
  identityId: string;
@@ -77,6 +85,8 @@ export interface TransferParams {
77
85
  */
78
86
  proofClass?: ProofClass;
79
87
  idempotencyKey?: string;
88
+ /** Submit even if the abstract account is known to hold no gas. See ProofGatedCallParams. */
89
+ skipFundingCheck?: boolean;
80
90
  }
81
91
  export interface OpenedIntent {
82
92
  intentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/resources/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAqB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvH;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,MAAM;IACrB,2GAA2G;IAC3G,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;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MAAM,CAAA;KAAO,GAC5D,OAAO,CACN;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,GACtF;QAAE,IAAI,EAAE,oBAAoB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAChG;YAiBa,IAAI;CAmCnB"}
@@ -1,5 +1,7 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { omitUndefined } from '../internal.js';
3
+ import { assertFundedForValue } from '../funding.js';
4
+ import { SignResource } from './sign.js';
3
5
  /** Terminal states. `wait()` stops on these rather than polling forever. */
4
6
  const DONE = ['completed', 'delivered', 'proven'];
5
7
  const FAILED = ['failed', 'error'];
@@ -26,6 +28,15 @@ export class ExecuteResource {
26
28
  * signature is in — which on an M-of-N page is not the same as executed. Follow with `wait()`.
27
29
  */
28
30
  async contractCall(p) {
31
+ // Before the intent exists, not after: an intent that can never execute should never be
32
+ // opened. A call forwarding no value is unaffected — the guard checks the amount first.
33
+ if (!p.skipFundingCheck) {
34
+ await assertFundedForValue(this.http, {
35
+ identityId: p.identityId,
36
+ chain: p.chain,
37
+ amount: p.contractCall.value,
38
+ });
39
+ }
29
40
  const intent = {
30
41
  adiUrl: p.adiUrl,
31
42
  legs: [{
@@ -57,6 +68,14 @@ export class ExecuteResource {
57
68
  }
58
69
  /** Authorize a native transfer, gated on proof. Same flow, simpler intent. */
59
70
  async transfer(p) {
71
+ if (!p.skipFundingCheck) {
72
+ await assertFundedForValue(this.http, {
73
+ identityId: p.identityId,
74
+ // The abstract account that pays is the one on the chain the value lands on.
75
+ chain: p.toChain,
76
+ amount: p.amount,
77
+ });
78
+ }
60
79
  return this.open({
61
80
  identity_id: p.identityId,
62
81
  intent: {
@@ -93,15 +112,18 @@ export class ExecuteResource {
93
112
  * cannot ask for signing data and decide the vote afterwards.
94
113
  */
95
114
  async cosign(p) {
96
- const { data: prep } = await this.http.post('/v1/sign', omitUndefined({
115
+ const prep = await new SignResource(this.http).create({
97
116
  type: 'pending_tx',
98
- target_id: p.accumTxHash,
117
+ targetId: p.accumTxHash,
99
118
  identity: p.identity,
100
- signer_url: p.signerUrl,
101
- public_key: p.publicKey,
119
+ signerUrl: p.signerUrl,
120
+ publicKey: p.publicKey,
102
121
  vote: p.vote ?? 'approve',
103
- }));
104
- const toSign = prep?.signing_data?.data_for_signature ?? prep?.signing_data?.hash_to_sign;
122
+ });
123
+ // `POST /v1/sign` names the bytes `data_for_signature`; only the intent flow calls it
124
+ // `hash_to_sign`. This used to read both because the raw post returned `any` — going through
125
+ // the typed resource makes the second name a compile error, and it never arrives here.
126
+ const toSign = prep?.signing_data?.data_for_signature;
105
127
  if (!toSign)
106
128
  throw new Error(`certen: no signing data returned for ${p.accumTxHash}`);
107
129
  const signature = await p.sign(toSign);
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/resources/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA2F/C,4EAA4E;AAC5E,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC,MAAM,OAAO,eAAe;IAEhB;IACA;IAFV,YACU,IAAmB,EACnB,iBAA+B;QAD/B,SAAI,GAAJ,IAAI,CAAe;QACnB,sBAAiB,GAAjB,iBAAiB,CAAc;IACtC,CAAC;IAEJ;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,CAAuB;QACxC,MAAM,MAAM,GAAsB;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,CAAC,gBAAgB;YAChC,WAAW,EAAG,IAAkC,CAAC,YAAY;SAC9D,CAAC;IACJ,CAAC;CACF;AAED,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import type { ReadinessReport } from '../types.js';
3
+ /**
4
+ * Is CERTEN able to serve right now?
5
+ *
6
+ * This answers the question that decides where someone should look when things do not work, and
7
+ * getting it wrong sends them somewhere useless. `GET /v1/chains` — which is what `doctor` used to
8
+ * lean on — proves only that the gateway is answering HTTP; it is a static registry read that keeps
9
+ * succeeding while the database, the api-bridge, the proof service or Accumulate are down. So the
10
+ * diagnosis said "gateway reachable: ok" and the user went looking at their own configuration for a
11
+ * fault that was never theirs.
12
+ *
13
+ * The case that matters most is `sponsor_below_floor`. When the onboarding sponsor account runs
14
+ * dry, identity creation still returns 202 and then never completes — the single worst failure mode
15
+ * in onboarding, because every visible signal says it worked. The probe reports it; nothing on the
16
+ * client side could see it.
17
+ *
18
+ * Public: no API key. That is deliberate on the gateway's side, and useful here — it means a
19
+ * caller whose credential is rejected can still find out whether the platform is the problem.
20
+ */
21
+ export declare class HealthResource {
22
+ private http;
23
+ constructor(http: AxiosInstance);
24
+ /**
25
+ * Whether the gateway can serve, and what is wrong when it cannot.
26
+ *
27
+ * **Does not throw on 503.** A not-ready answer is the answer — it carries the reasons, and
28
+ * turning it into an exception would discard exactly the information worth having. Only a genuine
29
+ * transport failure throws, which is itself the distinct and useful signal that nothing is
30
+ * answering at all.
31
+ */
32
+ ready(): Promise<ReadinessReport>;
33
+ }
34
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/resources/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEvC;;;;;;;OAOG;IACG,KAAK,IAAI,OAAO,CAAC,eAAe,CAAC;CAUxC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Is CERTEN able to serve right now?
3
+ *
4
+ * This answers the question that decides where someone should look when things do not work, and
5
+ * getting it wrong sends them somewhere useless. `GET /v1/chains` — which is what `doctor` used to
6
+ * lean on — proves only that the gateway is answering HTTP; it is a static registry read that keeps
7
+ * succeeding while the database, the api-bridge, the proof service or Accumulate are down. So the
8
+ * diagnosis said "gateway reachable: ok" and the user went looking at their own configuration for a
9
+ * fault that was never theirs.
10
+ *
11
+ * The case that matters most is `sponsor_below_floor`. When the onboarding sponsor account runs
12
+ * dry, identity creation still returns 202 and then never completes — the single worst failure mode
13
+ * in onboarding, because every visible signal says it worked. The probe reports it; nothing on the
14
+ * client side could see it.
15
+ *
16
+ * Public: no API key. That is deliberate on the gateway's side, and useful here — it means a
17
+ * caller whose credential is rejected can still find out whether the platform is the problem.
18
+ */
19
+ export class HealthResource {
20
+ http;
21
+ constructor(http) {
22
+ this.http = http;
23
+ }
24
+ /**
25
+ * Whether the gateway can serve, and what is wrong when it cannot.
26
+ *
27
+ * **Does not throw on 503.** A not-ready answer is the answer — it carries the reasons, and
28
+ * turning it into an exception would discard exactly the information worth having. Only a genuine
29
+ * transport failure throws, which is itself the distinct and useful signal that nothing is
30
+ * answering at all.
31
+ */
32
+ async ready() {
33
+ const { data, status } = await this.http.get('/v1/health/ready', {
34
+ // 503 is a documented outcome of this endpoint, not an error in it.
35
+ validateStatus: (s) => s === 200 || s === 503,
36
+ });
37
+ return {
38
+ ...data,
39
+ ready: status === 200 && data?.status === 'ready',
40
+ };
41
+ }
42
+ }
43
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/resources/health.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAE3C;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE;YAC/D,oEAAoE;YACpE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG;SAC9C,CAAC,CAAC;QACH,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,OAAO;SAClD,CAAC;IACJ,CAAC;CACF"}
@@ -1,5 +1,16 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import type { CreateIdentityParams, IdentityResponse, UpdateIdentityParams } from '../types.js';
2
+ import type { CreateIdentityParams, Identity, IdentityResponse, UpdateIdentityParams } from '../types.js';
3
+ /**
4
+ * Accept what the gateway actually handed the caller.
5
+ *
6
+ * `mnemonic_retrieval.url` is a path, not an id and a token — so a method taking `(id, token)` only
7
+ * would make every caller split a string, and splitting it wrongly costs them the seed. Both forms
8
+ * are accepted, and an absolute URL works too in case the gateway ever returns one.
9
+ */
10
+ export declare function parseMnemonicTarget(idOrUrl: string, token?: string): {
11
+ id: string;
12
+ token: string;
13
+ };
3
14
  export declare class IdentityResource {
4
15
  private http;
5
16
  constructor(http: AxiosInstance);
@@ -20,7 +31,46 @@ export declare class IdentityResource {
20
31
  * as a query string, where it was silently ignored — so the signature promised a capability the API does
21
32
  * not have.
22
33
  */
23
- get(id: string): Promise<IdentityResponse>;
34
+ get(id: string, opts?: {
35
+ /**
36
+ * Which enrichments to fetch. Defaults to ALL THREE, and each costs a live query —
37
+ * `governance` and `balances` hit the network, `balances` once PER LINKED CHAIN.
38
+ *
39
+ * Pass `[]` to skip them entirely. `status` and `can_sign` are computed before any
40
+ * enrichment runs and are always returned, so anything polling for readiness wants `[]`.
41
+ */
42
+ include?: Array<'governance' | 'balances' | 'pending'>;
43
+ }): Promise<IdentityResponse>;
44
+ /**
45
+ * Create an identity and wait until it is genuinely usable.
46
+ *
47
+ * `create()` returns `202` and provisioning continues, so the response it gives back says nothing
48
+ * about whether the identity works. Every integration then writes the same poll loop, and the
49
+ * ones that do not write it hand around an identity that fails at the last step of every flow.
50
+ *
51
+ * "Usable" is `status` terminal AND `can_sign === true`, and those fail for different reasons:
52
+ *
53
+ * - `can_sign === false` — provisioning finished, but the on-chain key page is not held by your
54
+ * key. The identity exists, consumes org quota, and can never sign.
55
+ * - `can_sign === null` — the key page could not be READ. That is UNKNOWN, not a soft yes, and an
56
+ * Accumulate outage is exactly when the distinction matters most. This keeps polling, and says
57
+ * plainly that it could not determine the answer if the budget runs out.
58
+ *
59
+ * A timeout is neither success nor failure — provisioning may still complete — so it throws
60
+ * rather than returning something a caller could mistake for a ready identity.
61
+ *
62
+ * **Not the right call for `signing_mode: "provider"`.** The one-shot mnemonic URL expires in
63
+ * about ten minutes and this method is allowed to wait five, so waiting first burns most of the
64
+ * window on the one flow where losing the token loses the seed. Use `create()`, call
65
+ * `retrieveMnemonic()` immediately, then poll `get()`. If you do use this, the URL is carried
66
+ * through on `mnemonic_retrieval` rather than dropped — but it may already have expired.
67
+ */
68
+ createAndWait(params: CreateIdentityParams, { timeoutMs, intervalMs, onPoll }?: {
69
+ timeoutMs?: number;
70
+ /** Overrides the cadence the gateway publishes. Leave unset to use it. */
71
+ intervalMs?: number;
72
+ onPoll?: (identity: Identity) => void;
73
+ }): Promise<Identity & Pick<IdentityResponse, 'mnemonic_retrieval'>>;
24
74
  /** Link or unlink chains, set a webhook, or supply a `publicKey` to repair an identity created without one. */
25
75
  update(id: string, params: UpdateIdentityParams): Promise<IdentityResponse>;
26
76
  /** Retire an identity, freeing the slot it occupies against the org quota. Soft delete inside Certen only:
@@ -28,5 +78,36 @@ export declare class IdentityResource {
28
78
  retire(id: string): Promise<{
29
79
  success: boolean;
30
80
  }>;
81
+ /**
82
+ * Collect the mnemonic generated for a `signing_mode: "provider"` identity. **Once.**
83
+ *
84
+ * This had no client surface at all, which made it the most dangerous gap in the SDK. Creating a
85
+ * provider-mode identity never returns the mnemonic inline — it returns a `mnemonic_retrieval.url`
86
+ * — and the token behind that URL is consumed atomically on first read. So a caller who did not
87
+ * hand-roll the HTTP request lost the seed permanently, on the one flow where the key material
88
+ * exists and CERTEN is holding it for them.
89
+ *
90
+ * **Two clocks are running.** The token expires (10 minutes by default, published as
91
+ * `mnemonic_retrieval.expires_in`) and it dies on first read. Call this immediately after
92
+ * `create()` and persist the result before doing anything else — including before waiting for
93
+ * provisioning to finish, which takes longer than the token lives.
94
+ *
95
+ * Pass either the URL the create response gave you, or the id and token separately:
96
+ *
97
+ * ```ts
98
+ * const created = await certen.identity.create({ name: 'ops', signingMode: 'provider' });
99
+ * if (created.mnemonic_retrieval) {
100
+ * const { mnemonic } = await certen.identity.retrieveMnemonic(created.mnemonic_retrieval.url);
101
+ * await saveToVault(mnemonic); // there is no second chance
102
+ * }
103
+ * ```
104
+ *
105
+ * Requires `identity:write`. A second call fails with 404 — indistinguishable, by design, from a
106
+ * token that never existed.
107
+ */
108
+ retrieveMnemonic(idOrUrl: string, token?: string): Promise<{
109
+ mnemonic: string;
110
+ warning?: string;
111
+ }>;
31
112
  }
32
113
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/resources/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB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