@phala/pay-server 0.0.0 → 0.9.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 (84) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +213 -1
  3. package/THIRD_PARTY_NOTICES +25 -0
  4. package/dist/js/src/shared/checkout-params.d.ts +7 -0
  5. package/dist/js/src/shared/checkout-params.d.ts.map +1 -0
  6. package/dist/js/src/shared/checkout-params.js +2 -0
  7. package/dist/js/src/shared/checkout-params.js.map +1 -0
  8. package/dist/js-server/src/addresses.d.ts +76 -0
  9. package/dist/js-server/src/addresses.d.ts.map +1 -0
  10. package/dist/js-server/src/addresses.js +117 -0
  11. package/dist/js-server/src/addresses.js.map +1 -0
  12. package/dist/js-server/src/browser.d.ts +2 -0
  13. package/dist/js-server/src/browser.d.ts.map +1 -0
  14. package/dist/js-server/src/browser.js +3 -0
  15. package/dist/js-server/src/browser.js.map +1 -0
  16. package/dist/js-server/src/client.d.ts +54 -0
  17. package/dist/js-server/src/client.d.ts.map +1 -0
  18. package/dist/js-server/src/client.js +183 -0
  19. package/dist/js-server/src/client.js.map +1 -0
  20. package/dist/js-server/src/errors.d.ts +35 -0
  21. package/dist/js-server/src/errors.d.ts.map +1 -0
  22. package/dist/js-server/src/errors.js +56 -0
  23. package/dist/js-server/src/errors.js.map +1 -0
  24. package/dist/js-server/src/generated/openapi.d.ts +9482 -0
  25. package/dist/js-server/src/generated/openapi.d.ts.map +1 -0
  26. package/dist/js-server/src/generated/openapi.js +6 -0
  27. package/dist/js-server/src/generated/openapi.js.map +1 -0
  28. package/dist/js-server/src/helpers.d.ts +15 -0
  29. package/dist/js-server/src/helpers.d.ts.map +1 -0
  30. package/dist/js-server/src/helpers.js +15 -0
  31. package/dist/js-server/src/helpers.js.map +1 -0
  32. package/dist/js-server/src/index.d.ts +12 -0
  33. package/dist/js-server/src/index.d.ts.map +1 -0
  34. package/dist/js-server/src/index.js +13 -0
  35. package/dist/js-server/src/index.js.map +1 -0
  36. package/dist/js-server/src/json.d.ts +5 -0
  37. package/dist/js-server/src/json.d.ts.map +1 -0
  38. package/dist/js-server/src/json.js +114 -0
  39. package/dist/js-server/src/json.js.map +1 -0
  40. package/dist/js-server/src/ledger.d.ts +9 -0
  41. package/dist/js-server/src/ledger.d.ts.map +1 -0
  42. package/dist/js-server/src/ledger.js +83 -0
  43. package/dist/js-server/src/ledger.js.map +1 -0
  44. package/dist/js-server/src/pins.d.ts +19 -0
  45. package/dist/js-server/src/pins.d.ts.map +1 -0
  46. package/dist/js-server/src/pins.js +165 -0
  47. package/dist/js-server/src/pins.js.map +1 -0
  48. package/dist/js-server/src/resource.d.ts +14 -0
  49. package/dist/js-server/src/resource.d.ts.map +1 -0
  50. package/dist/js-server/src/resource.js +32 -0
  51. package/dist/js-server/src/resource.js.map +1 -0
  52. package/dist/js-server/src/resources.d.ts +120 -0
  53. package/dist/js-server/src/resources.d.ts.map +1 -0
  54. package/dist/js-server/src/resources.js +266 -0
  55. package/dist/js-server/src/resources.js.map +1 -0
  56. package/dist/js-server/src/runtime.d.ts +4 -0
  57. package/dist/js-server/src/runtime.d.ts.map +1 -0
  58. package/dist/js-server/src/runtime.js +48 -0
  59. package/dist/js-server/src/runtime.js.map +1 -0
  60. package/dist/js-server/src/schemas.d.ts +4 -0
  61. package/dist/js-server/src/schemas.d.ts.map +1 -0
  62. package/dist/js-server/src/schemas.js +3091 -0
  63. package/dist/js-server/src/schemas.js.map +1 -0
  64. package/dist/js-server/src/sweeps.d.ts +78 -0
  65. package/dist/js-server/src/sweeps.d.ts.map +1 -0
  66. package/dist/js-server/src/sweeps.js +117 -0
  67. package/dist/js-server/src/sweeps.js.map +1 -0
  68. package/dist/js-server/src/transport.d.ts +26 -0
  69. package/dist/js-server/src/transport.d.ts.map +1 -0
  70. package/dist/js-server/src/transport.js +248 -0
  71. package/dist/js-server/src/transport.js.map +1 -0
  72. package/dist/js-server/src/types.d.ts +111 -0
  73. package/dist/js-server/src/types.d.ts.map +1 -0
  74. package/dist/js-server/src/types.js +2 -0
  75. package/dist/js-server/src/types.js.map +1 -0
  76. package/dist/js-server/src/validation.d.ts +20 -0
  77. package/dist/js-server/src/validation.d.ts.map +1 -0
  78. package/dist/js-server/src/validation.js +43 -0
  79. package/dist/js-server/src/validation.js.map +1 -0
  80. package/dist/js-server/src/webhook.d.ts +59 -0
  81. package/dist/js-server/src/webhook.d.ts.map +1 -0
  82. package/dist/js-server/src/webhook.js +164 -0
  83. package/dist/js-server/src/webhook.js.map +1 -0
  84. package/package.json +55 -4
@@ -0,0 +1,111 @@
1
+ import type { components, operations } from "./generated/openapi.js";
2
+ export type AccountObject = components["schemas"]["AccountObject"];
3
+ export type AccountSelfPauseRequest = components["schemas"]["AccountSelfPauseRequest"];
4
+ export type ApiKeyList = components["schemas"]["ApiKeyList"];
5
+ export type ApiKeyObject = components["schemas"]["ApiKeyObject"];
6
+ export type AttestationResponse = components["schemas"]["AttestationResponse"];
7
+ export type AvailableAsset = components["schemas"]["AvailableAsset"];
8
+ export type AvailableChain = components["schemas"]["AvailableChain"];
9
+ export type AvailableConfirmations = components["schemas"]["AvailableConfirmations"];
10
+ export type Balance = components["schemas"]["Balance"];
11
+ export type BalanceAmount = components["schemas"]["BalanceAmount"];
12
+ export type BoundsAtomic = components["schemas"]["BoundsAtomic"];
13
+ export type BoundsU64 = components["schemas"]["BoundsU64"];
14
+ export type ClientDepositAddress = components["schemas"]["ClientDepositAddress"];
15
+ export type ClientDepositAddressNetwork = components["schemas"]["ClientDepositAddressNetwork"];
16
+ export type ClientDepositAddressPayment = components["schemas"]["ClientDepositAddressPayment"];
17
+ export type ClientQuote = components["schemas"]["ClientQuote"];
18
+ export type Config = components["schemas"]["Config"];
19
+ export type ConfigAsset = components["schemas"]["ConfigAsset"];
20
+ export type CreateApiKeyRequest = components["schemas"]["CreateApiKeyRequest"];
21
+ export type CreateDepositAddressRequest = components["schemas"]["CreateDepositAddressRequest"];
22
+ export type CreateQuoteRequest = components["schemas"]["CreateQuoteRequest"];
23
+ export type CreateRefundRequest = components["schemas"]["CreateRefundRequest"];
24
+ export type CreateTreasuryChallengeRequest = components["schemas"]["CreateTreasuryChallengeRequest"];
25
+ export type CreateTreasuryRequest = components["schemas"]["CreateTreasuryRequest"];
26
+ export type CreateWebhookEndpointRequest = components["schemas"]["CreateWebhookEndpointRequest"];
27
+ export type DeletedWebhookEndpoint = components["schemas"]["DeletedWebhookEndpoint"];
28
+ export type DeliveryAttempt = components["schemas"]["DeliveryAttempt"];
29
+ export type Deposit = components["schemas"]["Deposit"];
30
+ export type DepositAddress = components["schemas"]["DepositAddress"];
31
+ export type DepositAddressAsset = components["schemas"]["DepositAddressAsset"];
32
+ export type DepositAddressList = components["schemas"]["DepositAddressList"];
33
+ export type DepositAddressNetwork = components["schemas"]["DepositAddressNetwork"];
34
+ export type DepositAddressView = components["schemas"]["DepositAddressView"];
35
+ export type DepositAdmin = components["schemas"]["DepositAdmin"];
36
+ export type DepositEventDelivery = components["schemas"]["DepositEventDelivery"];
37
+ export type DepositList = components["schemas"]["DepositList"];
38
+ export type DepositTransition = components["schemas"]["DepositTransition"];
39
+ export type ErrorDetail = components["schemas"]["ErrorDetail"];
40
+ export type ErrorResponse = components["schemas"]["ErrorResponse"];
41
+ export type ErrorType = components["schemas"]["ErrorType"];
42
+ export type EventData = components["schemas"]["EventData"];
43
+ export type EventList = components["schemas"]["EventList"];
44
+ export type EventObjectResponse = components["schemas"]["EventObjectResponse"];
45
+ export type EventRequest = components["schemas"]["EventRequest"];
46
+ export type ExpandableDeposit = components["schemas"]["ExpandableDeposit"];
47
+ export type ExpandableQuote = components["schemas"]["ExpandableQuote"];
48
+ export type Forwarder = components["schemas"]["Forwarder"];
49
+ export type ForwarderList = components["schemas"]["ForwarderList"];
50
+ export type MarkRefundPaidRequest = components["schemas"]["MarkRefundPaidRequest"];
51
+ export type MetadataClear = components["schemas"]["MetadataClear"];
52
+ export type MetadataParam = components["schemas"]["MetadataParam"];
53
+ export type Payment = components["schemas"]["Payment"];
54
+ export type PaymentSettingsAsset = components["schemas"]["PaymentSettingsAsset"];
55
+ export type PaymentSettingsChain = components["schemas"]["PaymentSettingsChain"];
56
+ export type PaymentSettingsObject = components["schemas"]["PaymentSettingsObject"];
57
+ export type Quote = components["schemas"]["Quote"];
58
+ export type QuoteList = components["schemas"]["QuoteList"];
59
+ export type QuoteTerms = components["schemas"]["QuoteTerms"];
60
+ export type QuoteView = components["schemas"]["QuoteView"];
61
+ export type Refund = components["schemas"]["Refund"];
62
+ export type RefundList = components["schemas"]["RefundList"];
63
+ export type ResendEventRequest = components["schemas"]["ResendEventRequest"];
64
+ export type RollApiKeyRequest = components["schemas"]["RollApiKeyRequest"];
65
+ export type RollWebhookKeyRequest = components["schemas"]["RollWebhookKeyRequest"];
66
+ export type Sweep = components["schemas"]["Sweep"];
67
+ export type SweepList = components["schemas"]["SweepList"];
68
+ export type Treasury = components["schemas"]["Treasury"];
69
+ export type TreasuryChallenge = components["schemas"]["TreasuryChallenge"];
70
+ export type TreasuryList = components["schemas"]["TreasuryList"];
71
+ export type UpdateMetadataRequest = components["schemas"]["UpdateMetadataRequest"];
72
+ export type UpdatePaymentSettingsRequest = components["schemas"]["UpdatePaymentSettingsRequest"];
73
+ export type UpdateWebhookEndpointRequest = components["schemas"]["UpdateWebhookEndpointRequest"];
74
+ export type WebhookEndpointList = components["schemas"]["WebhookEndpointList"];
75
+ export type WebhookEndpointObject = components["schemas"]["WebhookEndpointObject"];
76
+ export type WebhookKeyObject = components["schemas"]["WebhookKeyObject"];
77
+ export type WebhookKeyVersion = components["schemas"]["WebhookKeyVersion"];
78
+ export type AccountPauseQuotesParams = operations["pause_account"]["requestBody"]["content"]["application/json"];
79
+ export type AccountResumeQuotesParams = operations["resume_account"]["requestBody"]["content"]["application/json"];
80
+ export type AccountRollWebhookKeyParams = operations["roll_webhook_key"]["requestBody"]["content"]["application/json"];
81
+ export type ApiKeyListParams = NonNullable<operations["list_api_keys"]["parameters"]["query"]>;
82
+ export type ApiKeyCreateParams = operations["create_api_key"]["requestBody"]["content"]["application/json"];
83
+ export type ApiKeyRollParams = operations["roll_api_key"]["requestBody"]["content"]["application/json"];
84
+ export type DepositAddressListParams = NonNullable<operations["list_deposit_addresses"]["parameters"]["query"]>;
85
+ export type DepositAddressCreateParams = operations["create_deposit_address"]["requestBody"]["content"]["application/json"];
86
+ export type DepositAddressRetrieveParams = NonNullable<operations["get_deposit_address"]["parameters"]["query"]>;
87
+ export type DepositAddressUpdateParams = operations["update_deposit_address"]["requestBody"]["content"]["application/json"];
88
+ export type DepositListParams = NonNullable<operations["list_deposits"]["parameters"]["query"]>;
89
+ export type DepositRetrieveParams = NonNullable<operations["get_deposit"]["parameters"]["query"]>;
90
+ export type DepositUpdateParams = operations["update_deposit"]["requestBody"]["content"]["application/json"];
91
+ export type EventListParams = NonNullable<operations["list_events"]["parameters"]["query"]>;
92
+ export type EventResendParams = operations["resend_event"]["requestBody"]["content"]["application/json"];
93
+ export type ForwarderListParams = NonNullable<operations["list_forwarders"]["parameters"]["query"]>;
94
+ export type PaymentSettingUpdateParams = operations["update_payment_settings"]["requestBody"]["content"]["application/json"];
95
+ export type QuoteListParams = NonNullable<operations["list_quotes"]["parameters"]["query"]>;
96
+ export type QuoteCreateParams = operations["create_quote"]["requestBody"]["content"]["application/json"];
97
+ export type QuoteRetrieveParams = NonNullable<operations["get_quote"]["parameters"]["query"]>;
98
+ export type QuoteUpdateParams = operations["update_quote"]["requestBody"]["content"]["application/json"];
99
+ export type RefundListParams = NonNullable<operations["list_refunds"]["parameters"]["query"]>;
100
+ export type RefundCreateParams = operations["create_refund"]["requestBody"]["content"]["application/json"];
101
+ export type RefundRetrieveParams = NonNullable<operations["get_refund"]["parameters"]["query"]>;
102
+ export type RefundUpdateParams = operations["update_refund"]["requestBody"]["content"]["application/json"];
103
+ export type RefundMarkPaidParams = operations["mark_refund_paid"]["requestBody"]["content"]["application/json"];
104
+ export type SweepListParams = NonNullable<operations["list_sweeps"]["parameters"]["query"]>;
105
+ export type TreasuryListParams = NonNullable<operations["list_treasuries"]["parameters"]["query"]>;
106
+ export type TreasuryCreateParams = operations["create_treasury"]["requestBody"]["content"]["application/json"];
107
+ export type TreasuryChallengeParams = operations["create_treasury_challenge"]["requestBody"]["content"]["application/json"];
108
+ export type WebhookEndpointListParams = NonNullable<operations["list_webhook_endpoints"]["parameters"]["query"]>;
109
+ export type WebhookEndpointCreateParams = operations["create_webhook_endpoint"]["requestBody"]["content"]["application/json"];
110
+ export type WebhookEndpointUpdateParams = operations["update_webhook_endpoint"]["requestBody"]["content"]["application/json"];
111
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,yBAAyB,CAAC,CAAC;AACvF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AAC/E,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,wBAAwB,CAAC,CAAC;AACrF,MAAM,MAAM,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MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5F,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACnG,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC/G,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC5H,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACjH,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC9H,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ export interface Schema {
2
+ $ref?: string;
3
+ enum?: unknown[];
4
+ type?: string | string[];
5
+ required?: string[];
6
+ properties?: Record<string, Schema>;
7
+ additionalProperties?: boolean | Schema;
8
+ items?: Schema;
9
+ oneOf?: Schema[];
10
+ anyOf?: Schema[];
11
+ minimum?: number;
12
+ maximum?: number;
13
+ }
14
+ export interface Contract {
15
+ response: Schema;
16
+ body?: Schema;
17
+ }
18
+ /** Open response enums and extra fields are retained for additive /v1 compatibility. */
19
+ export declare function valid(value: unknown, schema: Schema): boolean;
20
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/validation.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CA6C7D"}
@@ -0,0 +1,43 @@
1
+ import { schemas } from "./schemas.js";
2
+ import { isRecord } from "./json.js";
3
+ /** Open response enums and extra fields are retained for additive /v1 compatibility. */
4
+ export function valid(value, schema) {
5
+ if (schema.$ref) {
6
+ const target = schemas[schema.$ref.split("/").at(-1) ?? ""];
7
+ return target !== undefined && valid(value, target);
8
+ }
9
+ const alternatives = schema.oneOf ?? schema.anyOf;
10
+ if (alternatives)
11
+ return alternatives.some((candidate) => valid(value, candidate));
12
+ const types = Array.isArray(schema.type) ? schema.type : [schema.type];
13
+ if (value === null)
14
+ return types.includes("null");
15
+ if (types.includes("object")) {
16
+ if (!isRecord(value) || schema.required?.some((key) => !Object.hasOwn(value, key)))
17
+ return false;
18
+ const known = Object.entries(schema.properties ?? {}).every(([key, shape]) => !Object.hasOwn(value, key) ||
19
+ (value[key] === undefined && !schema.required?.includes(key)) ||
20
+ valid(value[key], shape));
21
+ if (!known)
22
+ return false;
23
+ const extra = schema.additionalProperties;
24
+ // Ignore unknown response fields; typed dictionaries still validate their values.
25
+ return (typeof extra !== "object" ||
26
+ Object.entries(value).every(([key, item]) => Object.hasOwn(schema.properties ?? {}, key) || valid(item, extra)));
27
+ }
28
+ if (types.includes("array"))
29
+ return (Array.isArray(value) &&
30
+ (!schema.items || value.every((item) => valid(item, schema.items ?? {}))));
31
+ if (types.includes("integer") || types.includes("number"))
32
+ return (typeof value === "number" &&
33
+ Number.isFinite(value) &&
34
+ (!types.includes("integer") || Number.isSafeInteger(value)) &&
35
+ (schema.minimum === undefined || value >= schema.minimum) &&
36
+ (schema.maximum === undefined || value <= schema.maximum));
37
+ if (types.includes("string"))
38
+ return typeof value === "string" && (!schema.enum || schema.enum.includes(value));
39
+ if (types.includes("boolean"))
40
+ return typeof value === "boolean";
41
+ return true;
42
+ }
43
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAkBrC,wFAAwF;AACxF,MAAM,UAAU,KAAK,CAAC,KAAc,EAAE,MAAc;IAClD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CA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O,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;IACjE,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Standard Webhooks `v1a` verification of Phala Pay deliveries (design D11): an ed25519 signature
3
+ * over `{webhook-id}.{webhook-timestamp}.{body}` by your account's webhook key in the endpoint's
4
+ * mode, pinned from `GET /v1/attestation`. Uses WebCrypto, so it runs on Node 20+, Deno, Bun, and
5
+ * edge runtimes.
6
+ */
7
+ /** A delivery that did not verify: answer `400` and do nothing. */
8
+ export { SignatureVerificationError as WebhookSignatureError } from "./errors.js";
9
+ /** A verified event. `data.object` is the object the event is about, such as a deposit. */
10
+ export interface WebhookEvent {
11
+ /** `evt_…`, stable across retries and resends: process each id once. */
12
+ id: string;
13
+ object: "event";
14
+ /** Your account, `acct_…`. */
15
+ account: string;
16
+ livemode: boolean;
17
+ /** Such as `deposit.credited`; claw back a `deposit.reversed` deposit's credit. */
18
+ type: string;
19
+ created: number;
20
+ /** Who caused it: an API key id (`key_…`), `admin`, or `system`. */
21
+ actor: string;
22
+ /**
23
+ * The API request that caused it, with the `Idempotency-Key` it sent; `null` when the
24
+ * service's own workers did (a payment credited, a quote expired).
25
+ */
26
+ request: {
27
+ id: string;
28
+ idempotency_key: string | null;
29
+ } | null;
30
+ /**
31
+ * `object` is the object as it was when the event happened, never re-rendered; `*.updated`
32
+ * events add `previous_attributes`, the former values of what changed.
33
+ */
34
+ data: {
35
+ object: Record<string, unknown>;
36
+ previous_attributes?: Record<string, unknown>;
37
+ };
38
+ }
39
+ export interface ConstructEventOptions {
40
+ /** Your account id, `acct_…`: an event of another account fails closed. */
41
+ expectedAccount: string;
42
+ /** The mode of the endpoint receiving it: an event of the other mode fails closed. */
43
+ expectedLivemode: boolean;
44
+ /** Finite, non-negative seconds a delivery's timestamp may differ from now; default 300. */
45
+ tolerance?: number;
46
+ /** Finite current time in Unix seconds; for tests. */
47
+ now?: number;
48
+ }
49
+ /**
50
+ * Verifies a delivery and returns its event, as Stripe's `constructEvent` does, failing closed
51
+ * unless a `v1a` signature verifies with one of `publicKeys` (ed25519 keys in Standard Webhooks'
52
+ * `whpk_` form, as `GET /v1/attestation` lists them; pass both while a rotation overlaps), the
53
+ * timestamp is within tolerance, the body's id is the `webhook-id`, and the event is
54
+ * `expectedAccount`'s in `expectedLivemode`.
55
+ *
56
+ * `payload` is the raw request body, before any JSON parsing.
57
+ */
58
+ export declare function constructEvent(payload: string | Uint8Array, headers: Headers | Record<string, string | string[] | undefined>, publicKeys: string | readonly string[], options: ConstructEventOptions): Promise<WebhookEvent>;
59
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/webhook.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,mEAAmE;AACnE,OAAO,EAAE,0BAA0B,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGlF,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D;;;OAGG;IACH,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC1F;AAED,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EAChE,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACtC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,YAAY,CAAC,CA2GvB"}
@@ -0,0 +1,164 @@
1
+ import { parseJson } from "./json.js";
2
+ /**
3
+ * Standard Webhooks `v1a` verification of Phala Pay deliveries (design D11): an ed25519 signature
4
+ * over `{webhook-id}.{webhook-timestamp}.{body}` by your account's webhook key in the endpoint's
5
+ * mode, pinned from `GET /v1/attestation`. Uses WebCrypto, so it runs on Node 20+, Deno, Bun, and
6
+ * edge runtimes.
7
+ */
8
+ /** A delivery that did not verify: answer `400` and do nothing. */
9
+ export { SignatureVerificationError as WebhookSignatureError } from "./errors.js";
10
+ import { SignatureVerificationError as WebhookSignatureError } from "./errors.js";
11
+ /**
12
+ * Verifies a delivery and returns its event, as Stripe's `constructEvent` does, failing closed
13
+ * unless a `v1a` signature verifies with one of `publicKeys` (ed25519 keys in Standard Webhooks'
14
+ * `whpk_` form, as `GET /v1/attestation` lists them; pass both while a rotation overlaps), the
15
+ * timestamp is within tolerance, the body's id is the `webhook-id`, and the event is
16
+ * `expectedAccount`'s in `expectedLivemode`.
17
+ *
18
+ * `payload` is the raw request body, before any JSON parsing.
19
+ */
20
+ export async function constructEvent(payload, headers, publicKeys, options) {
21
+ if (options.expectedAccount === "") {
22
+ throw new TypeError("expectedAccount is required");
23
+ }
24
+ const now = options.now ?? Math.floor(Date.now() / 1000);
25
+ const tolerance = options.tolerance ?? 300;
26
+ if (!Number.isFinite(now) || !Number.isFinite(tolerance) || tolerance < 0) {
27
+ throw new TypeError("webhook now must be finite and tolerance finite and non-negative");
28
+ }
29
+ const body = typeof payload === "string" ? new TextEncoder().encode(payload) : payload;
30
+ if (typeof payload === "string" &&
31
+ new TextDecoder("utf-8", { fatal: true }).decode(body) !== payload)
32
+ throw new WebhookSignatureError("webhook body is not exact UTF-8");
33
+ const id = header(headers, "webhook-id");
34
+ const timestamp = header(headers, "webhook-timestamp");
35
+ const signatures = header(headers, "webhook-signature");
36
+ if (id === undefined || timestamp === undefined || signatures === undefined) {
37
+ throw new WebhookSignatureError("webhook headers missing");
38
+ }
39
+ if (!/^\d+$/.test(timestamp) || !Number.isSafeInteger(Number(timestamp))) {
40
+ throw new WebhookSignatureError("webhook timestamp malformed");
41
+ }
42
+ if (Math.abs(now - Number(timestamp)) > tolerance) {
43
+ throw new WebhookSignatureError("webhook timestamp outside tolerance");
44
+ }
45
+ const signed = concat(new TextEncoder().encode(`${id}.${timestamp}.`), body);
46
+ const keys = await Promise.all((typeof publicKeys === "string" ? [publicKeys] : publicKeys).map(importKey));
47
+ if (keys.length === 0) {
48
+ throw new TypeError("no webhook public key pinned");
49
+ }
50
+ let verified = false;
51
+ for (const entry of signatures.split(" ")) {
52
+ if (entry.split(",").length !== 2)
53
+ throw new WebhookSignatureError("duplicate or malformed webhook signature");
54
+ const [version, encoded] = entry.split(",", 2);
55
+ const signature = version === "v1a" && encoded !== undefined ? base64(encoded) : undefined;
56
+ if (signature === undefined) {
57
+ continue;
58
+ }
59
+ for (const key of keys) {
60
+ if (await crypto.subtle.verify("Ed25519", key, signature, signed)) {
61
+ verified = true;
62
+ }
63
+ }
64
+ }
65
+ if (!verified) {
66
+ throw new WebhookSignatureError("no valid webhook signature");
67
+ }
68
+ let event;
69
+ try {
70
+ event = parseJson(new TextDecoder("utf-8", { fatal: true }).decode(body));
71
+ }
72
+ catch {
73
+ throw new TypeError("webhook body is not an event");
74
+ }
75
+ if (!isRecord(event)) {
76
+ throw new TypeError("webhook body is not an event");
77
+ }
78
+ const e = event;
79
+ const data = e["data"];
80
+ const object = isRecord(data) ? data["object"] : null;
81
+ const { id: eventId, type, account, livemode, created, actor, request } = e;
82
+ if (e["object"] !== "event" ||
83
+ typeof eventId !== "string" ||
84
+ typeof type !== "string" ||
85
+ typeof account !== "string" ||
86
+ typeof livemode !== "boolean" ||
87
+ typeof created !== "number" ||
88
+ !Number.isSafeInteger(created) ||
89
+ !isRecord(object) ||
90
+ typeof actor !== "string" ||
91
+ !(request === null || isRequest(request))) {
92
+ throw new TypeError("webhook body is not an event");
93
+ }
94
+ if (eventId !== id) {
95
+ throw new WebhookSignatureError("webhook id does not match the event");
96
+ }
97
+ if (account !== options.expectedAccount) {
98
+ throw new WebhookSignatureError("webhook event is for another account");
99
+ }
100
+ if (livemode !== options.expectedLivemode) {
101
+ throw new WebhookSignatureError("webhook event is for the other mode");
102
+ }
103
+ const previous = isRecord(data) ? data["previous_attributes"] : undefined;
104
+ return {
105
+ ...e,
106
+ id: eventId,
107
+ object: "event",
108
+ account,
109
+ livemode,
110
+ type,
111
+ created,
112
+ actor,
113
+ request,
114
+ data: {
115
+ ...(isRecord(data)
116
+ ? Object.fromEntries(Object.entries(data).filter(([key]) => key !== "previous_attributes"))
117
+ : {}),
118
+ object,
119
+ ...(isRecord(previous) ? { previous_attributes: previous } : {}),
120
+ },
121
+ };
122
+ }
123
+ function header(headers, name) {
124
+ if (headers instanceof Headers) {
125
+ return headers.get(name)?.trim() ?? undefined;
126
+ }
127
+ const matches = Object.entries(headers).filter(([key]) => key.toLowerCase() === name);
128
+ if (matches.length > 1)
129
+ throw new WebhookSignatureError("duplicate webhook header");
130
+ const value = matches[0]?.[1];
131
+ if (Array.isArray(value))
132
+ throw new WebhookSignatureError("duplicate webhook header");
133
+ return value?.trim();
134
+ }
135
+ function isRecord(value) {
136
+ return typeof value === "object" && value !== null && !Array.isArray(value);
137
+ }
138
+ function isRequest(value) {
139
+ if (!isRecord(value)) {
140
+ return false;
141
+ }
142
+ const { id, idempotency_key: key } = value;
143
+ return typeof id === "string" && (key === null || typeof key === "string");
144
+ }
145
+ async function importKey(encoded) {
146
+ const raw = encoded.startsWith("whpk_") ? base64(encoded.slice("whpk_".length)) : undefined;
147
+ if (raw?.length !== 32) {
148
+ throw new TypeError("a webhook public key is whpk_ and the base64 of 32 bytes");
149
+ }
150
+ return crypto.subtle.importKey("raw", raw, "Ed25519", false, ["verify"]);
151
+ }
152
+ function base64(value) {
153
+ if (!/^[A-Za-z0-9+/]*={0,2}$/.test(value) || value.length % 4 !== 0) {
154
+ return undefined;
155
+ }
156
+ return Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
157
+ }
158
+ function concat(left, right) {
159
+ const joined = new Uint8Array(left.length + right.length);
160
+ joined.set(left);
161
+ joined.set(right, left.length);
162
+ return joined;
163
+ }
164
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../src/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC;;;;;GAKG;AAEH,mEAAmE;AACnE,OAAO,EAAE,0BAA0B,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,0BAA0B,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAsClF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA4B,EAC5B,OAAgE,EAChE,UAAsC,EACtC,OAA8B;IAE9B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;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,59 @@
1
1
  {
2
2
  "name": "@phala/pay-server",
3
- "version": "0.0.0",
4
- "description": "Placeholder to reserve @phala/pay-server for Phala Pay; the first real release is 0.9.0.",
3
+ "version": "0.9.1",
4
+ "description": "Phala Pay merchant server SDK",
5
5
  "license": "Apache-2.0",
6
- "repository": { "type": "git", "url": "git+https://github.com/Phala-Network/phala-pay.git" },
7
- "files": ["README.md"]
6
+ "homepage": "https://github.com/Phala-Network/phala-pay/tree/main/sdk/js-server#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Phala-Network/phala-pay.git",
10
+ "directory": "sdk/js-server"
11
+ },
12
+ "type": "module",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/js-server/src/index.d.ts",
16
+ "default": "./dist/js-server/src/index.js"
17
+ },
18
+ "./helpers": {
19
+ "types": "./dist/js-server/src/helpers.d.ts",
20
+ "default": "./dist/js-server/src/helpers.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "THIRD_PARTY_NOTICES"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "packageManager": "pnpm@12.6.0",
31
+ "engines": {
32
+ "node": ">=20.3"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.build.json",
36
+ "prepare": "tsc -p tsconfig.build.json",
37
+ "typecheck": "tsc --noEmit",
38
+ "lint": "eslint .",
39
+ "test": "vitest run",
40
+ "check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run build && pnpm run check-generated",
41
+ "generate:types": "openapi-typescript ../../crates/topup/openapi.json -o src/generated/openapi.ts --immutable && node scripts/generate-server.mjs",
42
+ "check-generated": "bash ../scripts/check-generated-js.sh server",
43
+ "generate:server": "node scripts/generate-server.mjs"
44
+ },
45
+ "dependencies": {
46
+ "viem": "^2.57.2"
47
+ },
48
+ "devDependencies": {
49
+ "@eslint/js": "^10.0.1",
50
+ "@types/node": "^26.6.4",
51
+ "eslint": "^10.11.0",
52
+ "openapi-typescript": "7.13.0",
53
+ "typescript": "~6.0.3",
54
+ "typescript-eslint": "^8.70.1",
55
+ "vitest": "^5.0.3",
56
+ "vite": "^8.3.2",
57
+ "jsdom": "^30.1.1"
58
+ }
8
59
  }