@agent-cards/sdk 0.21.0 → 0.22.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.
- package/CHANGELOG.md +47 -0
- package/PREFLIGHT.md +30 -0
- package/README.md +1070 -21
- package/dist/aci.d.ts +173 -0
- package/dist/aci.generated.d.ts +87 -0
- package/dist/aci.generated.js +306 -0
- package/dist/aci.js +371 -0
- package/dist/adyen-merchant-hosted.generated.d.ts +3 -3
- package/dist/adyen-merchant-hosted.generated.js +283 -49
- package/dist/agentcard.d.ts +9 -2
- package/dist/agentcard.js +4 -2
- package/dist/amadeus-checkout.generated.d.ts +57 -0
- package/dist/amadeus-checkout.generated.js +549 -0
- package/dist/amadeus.d.ts +41 -0
- package/dist/amadeus.js +81 -0
- package/dist/builtin-registry.generated.js +1 -1
- package/dist/card-endpoint.d.ts +177 -0
- package/dist/card-endpoint.js +286 -0
- package/dist/card-fields.generated.d.ts +5 -3
- package/dist/card-fields.generated.js +284 -7
- package/dist/cdp.d.ts +5 -1
- package/dist/cdp.js +841 -135
- package/dist/client.d.ts +403 -19
- package/dist/client.js +949 -98
- package/dist/creditguard.generated.d.ts +79 -0
- package/dist/creditguard.generated.js +662 -0
- package/dist/cse-body.js +11 -1
- package/dist/datatrans.d.ts +96 -0
- package/dist/datatrans.generated.d.ts +64 -0
- package/dist/datatrans.generated.js +426 -0
- package/dist/datatrans.js +178 -0
- package/dist/elavon-converge.d.ts +37 -0
- package/dist/elavon-converge.generated.d.ts +49 -0
- package/dist/elavon-converge.generated.js +439 -0
- package/dist/elavon-converge.js +84 -0
- package/dist/eprotect.d.ts +152 -0
- package/dist/eprotect.generated.d.ts +77 -0
- package/dist/eprotect.generated.js +498 -0
- package/dist/eprotect.js +222 -0
- package/dist/hosted-form.d.ts +3 -2
- package/dist/hosted-form.js +3 -2
- package/dist/index.d.ts +17 -3
- package/dist/index.js +6 -1
- package/dist/juspay-gate.d.ts +82 -0
- package/dist/juspay-gate.js +126 -0
- package/dist/juspay.generated.d.ts +89 -0
- package/dist/juspay.generated.js +705 -0
- package/dist/lifecycle.d.ts +57 -6
- package/dist/lifecycle.js +119 -8
- package/dist/merchant-card-endpoints.generated.d.ts +63 -0
- package/dist/merchant-card-endpoints.generated.js +1103 -0
- package/dist/merchant-hosted.d.ts +4 -1
- package/dist/merchant-hosted.js +5 -2
- package/dist/merchant-session-probe.d.ts +48 -0
- package/dist/merchant-session-probe.js +53 -0
- package/dist/merchant-session.generated.d.ts +69 -0
- package/dist/merchant-session.generated.js +919 -0
- package/dist/payrails.d.ts +133 -0
- package/dist/payrails.generated.d.ts +73 -0
- package/dist/payrails.generated.js +596 -0
- package/dist/payrails.js +305 -0
- package/dist/pelecard.d.ts +32 -0
- package/dist/pelecard.generated.d.ts +32 -0
- package/dist/pelecard.generated.js +283 -0
- package/dist/pelecard.js +42 -0
- package/dist/pre-claim.d.ts +72 -2
- package/dist/pre-claim.js +857 -5
- package/dist/preflight-catalog.json +2218 -287
- package/dist/preflight-schemas.json +179 -6
- package/dist/preflight.generated.d.ts +1 -1
- package/dist/preflight.generated.js +233 -4
- package/dist/preparation.d.ts +5 -2
- package/dist/preparation.js +36 -10
- package/dist/prepared-processor.d.ts +84 -5
- package/dist/prepared-processor.js +147 -6
- package/dist/primer.d.ts +53 -0
- package/dist/primer.generated.d.ts +38 -0
- package/dist/primer.generated.js +624 -0
- package/dist/primer.js +82 -0
- package/dist/registry.d.ts +100 -8
- package/dist/registry.js +85 -11
- package/dist/shiji-sts.d.ts +144 -0
- package/dist/shiji-sts.generated.d.ts +72 -0
- package/dist/shiji-sts.generated.js +913 -0
- package/dist/shiji-sts.js +222 -0
- package/dist/stripe-checkout.generated.d.ts +1 -1
- package/dist/stripe-checkout.generated.js +699 -9
- package/dist/stripe-setup.d.ts +16 -0
- package/dist/stripe-setup.js +61 -0
- package/dist/substitutions.generated.js +187 -29
- package/dist/verifone.d.ts +68 -0
- package/dist/verifone.generated.d.ts +51 -0
- package/dist/verifone.generated.js +1401 -0
- package/dist/verifone.js +119 -0
- package/dist/voice-types.d.ts +27 -0
- package/dist/voice.d.ts +6 -1
- package/dist/voice.js +6 -1
- package/dist/wspay.d.ts +41 -0
- package/dist/wspay.generated.d.ts +41 -0
- package/dist/wspay.generated.js +370 -0
- package/dist/wspay.js +65 -0
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { PAYRAILS_CAPABILITY, PAYRAILS_PSP } from './payrails.generated.js';
|
|
2
|
+
export { PAYRAILS_CAPABILITY, PAYRAILS_PSP };
|
|
3
|
+
/**
|
|
4
|
+
* How the pre-claim gate reads a POST to a Payrails host: `card` for a card save on a save URL
|
|
5
|
+
* (data.encryptedData present, payment-core's pause predicate), `card_payment` for a payment that
|
|
6
|
+
* carries an encrypted card inside paymentComposition, and null for anything else, which continues.
|
|
7
|
+
*/
|
|
8
|
+
export declare function payrailsRequestKind(url: string, method: string, body: string): 'card' | 'card_payment' | null;
|
|
9
|
+
/**
|
|
10
|
+
* Why a Payrails request was aborted, reported as the `reason` of the `unsupported_checkout` event:
|
|
11
|
+
* unsupported_payrails_card_payment a payment that sends an encrypted card inside
|
|
12
|
+
* paymentComposition; the attachment holds
|
|
13
|
+
* payrails_request_malformed, payrails_not_card_save, payrails_jwe_malformed,
|
|
14
|
+
* payrails_future_usage_refused, payrails_card_on_file_consent_required
|
|
15
|
+
* a card save payment-core's guard refuses; the attachment holds
|
|
16
|
+
* payrails_session_unavailable no captured session matches the save; that request only
|
|
17
|
+
* payrails_key_invalid, payrails_key_mismatch
|
|
18
|
+
* the captured key cannot be the frame's; that request only
|
|
19
|
+
*/
|
|
20
|
+
export type PayrailsUnsupportedReason = 'unsupported_payrails_card_payment' | 'payrails_request_malformed' | 'payrails_not_card_save' | 'payrails_jwe_malformed' | 'payrails_future_usage_refused' | 'payrails_card_on_file_consent_required' | 'payrails_session_unavailable' | 'payrails_key_invalid' | 'payrails_key_mismatch';
|
|
21
|
+
/** Refusals of the save's own shape: the page's next save would be the same, so the attachment holds. */
|
|
22
|
+
export declare const PAYRAILS_HOLDING_REASONS: readonly PayrailsUnsupportedReason[];
|
|
23
|
+
/** What the agent reads when a save's session cannot be bound. Not shown to the cardholder. */
|
|
24
|
+
export declare const PAYRAILS_SESSION_MESSAGE = "Payrails session expired, reload the checkout";
|
|
25
|
+
/** Captured sessions kept per attachment; the oldest is dropped first. */
|
|
26
|
+
export declare const PAYRAILS_CAPTURE_LIMIT = 8;
|
|
27
|
+
/** How long a captured session is kept at all. */
|
|
28
|
+
export declare const PAYRAILS_CAPTURE_TTL_MS: number;
|
|
29
|
+
/** How old a captured session may be when its save pauses: Payrails gives a session key ten minutes. */
|
|
30
|
+
export declare const PAYRAILS_SESSION_MAX_AGE_MS: number;
|
|
31
|
+
/** The largest answer body read for an init payload. */
|
|
32
|
+
export declare const PAYRAILS_INIT_BODY_LIMIT: number;
|
|
33
|
+
/** How long a paused save waits for answer bodies still being read before it binds. */
|
|
34
|
+
export declare const PAYRAILS_PENDING_READ_MS = 1000;
|
|
35
|
+
/** Fetch interception patterns for every Payrails host, armed only for an org the API served Payrails to. */
|
|
36
|
+
export declare const PAYRAILS_GUARD_PATTERNS: readonly string[];
|
|
37
|
+
/** One captured Payrails session: the init payload's binding fields and its key. Never logged. */
|
|
38
|
+
export interface PayrailsSession {
|
|
39
|
+
readonly token: string;
|
|
40
|
+
readonly holderReference: string;
|
|
41
|
+
readonly providerConfigId: string;
|
|
42
|
+
readonly saveInstrumentHref: string;
|
|
43
|
+
readonly encryptionPublicKey: string;
|
|
44
|
+
readonly seenAt: number;
|
|
45
|
+
}
|
|
46
|
+
type SessionFields = Omit<PayrailsSession, 'seenAt'>;
|
|
47
|
+
/** What the create carries beside a Payrails save: the session key its page encrypted under. */
|
|
48
|
+
export interface PayrailsSidecar {
|
|
49
|
+
readonly encryption_public_key: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Every Payrails init payload one JSON answer body carries: the body itself, or its members one
|
|
53
|
+
* level down (an object's values or an array's items). An init payload is `{version, data}` whose
|
|
54
|
+
* `data` decodes to JSON with a token, a holderReference and a vaultConfiguration naming its
|
|
55
|
+
* providerConfigId, its encryptionPublicKey and a saveInstrument href on a Payrails save URL.
|
|
56
|
+
*/
|
|
57
|
+
export declare function payrailsInitSessions(body: unknown): SessionFields[];
|
|
58
|
+
/** Whether an answer may carry an init payload worth reading: a 2xx XHR or fetch with a JSON type. */
|
|
59
|
+
export declare function payrailsInitCandidate(resourceType: unknown, status: unknown, contentType: unknown): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The Payrails sessions one attachment has seen, in memory only: at most PAYRAILS_CAPTURE_LIMIT,
|
|
62
|
+
* each dropped PAYRAILS_CAPTURE_TTL_MS after it was first seen. Nothing here is ever logged or
|
|
63
|
+
* reported; the key leaves it only on the create for the one save it binds to.
|
|
64
|
+
*
|
|
65
|
+
* The capture runs on the agent's side and trusts nothing it reads: a page can hand it any key.
|
|
66
|
+
* The binding catches a stale session or a runtime bug. What bounds a key an agent supplies is
|
|
67
|
+
* elsewhere: the device sends the ciphertext only to a Payrails host, the API holds the token to
|
|
68
|
+
* the Payrails workspace Agentcard reviewed for the merchant, and the page never sees the
|
|
69
|
+
* ciphertext the device made.
|
|
70
|
+
*/
|
|
71
|
+
export declare class PayrailsSessionCapture {
|
|
72
|
+
private sessions;
|
|
73
|
+
private readonly reads;
|
|
74
|
+
/** Record the init payloads an answer body carries; how many it carried. Never throws. */
|
|
75
|
+
observe(body: unknown, now?: number): number;
|
|
76
|
+
/** An answer body still being read: a save that pauses meanwhile waits for it, briefly. */
|
|
77
|
+
reading(read: Promise<unknown>): void;
|
|
78
|
+
/** Whether an answer body is still being read. */
|
|
79
|
+
get pending(): boolean;
|
|
80
|
+
/** Wait for the answer bodies being read, at most `ms`. */
|
|
81
|
+
settle(ms?: number): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* The session key for a paused card save: the key of the captured session whose token is the
|
|
84
|
+
* save's bearer token, whose saveInstrument href is the save's URL, and whose holderReference and
|
|
85
|
+
* providerConfigId are the body's, first seen at most PAYRAILS_SESSION_MAX_AGE_MS before `now`.
|
|
86
|
+
* Null when none matches, or when matching sessions disagree on the key.
|
|
87
|
+
*/
|
|
88
|
+
keyFor(request: {
|
|
89
|
+
url: string;
|
|
90
|
+
headers?: Record<string, string>;
|
|
91
|
+
body: string | null;
|
|
92
|
+
}, now?: number): string | null;
|
|
93
|
+
/** How many sessions are held; for tests. */
|
|
94
|
+
get size(): number;
|
|
95
|
+
private prune;
|
|
96
|
+
}
|
|
97
|
+
type VaultLike = {
|
|
98
|
+
isCardRequest?: (url: string, method?: string) => boolean;
|
|
99
|
+
checkoutModeOf?: (url: string, method?: string) => string | null;
|
|
100
|
+
} | null | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the vault's current registry pauses Payrails' card save in mode device_encrypt: true only
|
|
103
|
+
* after syncRegistry() for an org the API serves the dark entry to. Everything Payrails-specific in
|
|
104
|
+
* the adapters (reading answers, intercepting Payrails hosts) runs only when this is true.
|
|
105
|
+
*/
|
|
106
|
+
export declare function recognizesPayrails(vault: VaultLike): boolean;
|
|
107
|
+
/** A Payrails host: https on the standard port, no userinfo, a hostname under payrails.io. */
|
|
108
|
+
export declare function isPayrailsHost(rawUrl: string): boolean;
|
|
109
|
+
/** Payrails' static host: it serves the web SDK and the secure frame's files, and takes no payment. */
|
|
110
|
+
export declare const PAYRAILS_STATIC_HOST = "assets.payrails.io";
|
|
111
|
+
/** A Payrails host (isPayrailsHost) that is exactly the static host. */
|
|
112
|
+
export declare function isPayrailsStaticHost(rawUrl: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* payment-core's judgement of a card save's own shape, before any session is looked up: null when
|
|
115
|
+
* the save is the SDK's exact card save and keeps no card on file the cardholder has not consented
|
|
116
|
+
* to, else the refusal code. A guard that throws refuses.
|
|
117
|
+
*/
|
|
118
|
+
export declare function payrailsSaveRefusal(body: string): PayrailsUnsupportedReason | null;
|
|
119
|
+
/**
|
|
120
|
+
* The key check for a bound session: null when the captured key is an RSA-2048, 3072 or 4096 key as
|
|
121
|
+
* long as the key the page's frame wrapped for this save, else the refusal code.
|
|
122
|
+
*/
|
|
123
|
+
export declare function payrailsKeyRefusal(key: string, body: string): PayrailsUnsupportedReason | null;
|
|
124
|
+
/**
|
|
125
|
+
* The only answer the page may receive for an approved Payrails save: Payrails' 201 for a card
|
|
126
|
+
* instrument, rebuilt from payment-core's allow-list (the BIN cut to six digits), under a JSON
|
|
127
|
+
* content type. Null for anything else.
|
|
128
|
+
*/
|
|
129
|
+
export declare function payrailsSaveAnswer(status: number, body: string): {
|
|
130
|
+
status: 201;
|
|
131
|
+
headers: Record<string, string>;
|
|
132
|
+
body: string;
|
|
133
|
+
} | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
declare var PAYRAILS_PSP: string;
|
|
2
|
+
declare var PAYRAILS_CAPABILITY: string;
|
|
3
|
+
declare var PAYRAILS_OPERATION: string;
|
|
4
|
+
declare var PAYRAILS_SAVE_PATH: string;
|
|
5
|
+
declare var PAYRAILS_SAVE_HOSTS: readonly string[];
|
|
6
|
+
declare var PAYRAILS_JWE_HEADER: string;
|
|
7
|
+
declare var PAYRAILS_JWE_HEADER_B64: string;
|
|
8
|
+
declare var PAYRAILS_KEY_BITS: readonly number[];
|
|
9
|
+
declare var PAYRAILS_FUTURE_USAGES: readonly string[];
|
|
10
|
+
declare var PAYRAILS_CARD_ON_FILE_CONSENTED: readonly never[];
|
|
11
|
+
declare var PAYRAILS_SESSION_MIN_SECONDS: number;
|
|
12
|
+
declare var PAYRAILS_REFUSALS: Readonly<{
|
|
13
|
+
payrails_request_malformed: string;
|
|
14
|
+
payrails_not_card_save: string;
|
|
15
|
+
payrails_jwe_malformed: string;
|
|
16
|
+
payrails_future_usage_refused: "Refusing to pay: this Payrails save asks to keep the card for a use the Vault cannot approve yet. Nothing was sent.";
|
|
17
|
+
payrails_card_on_file_consent_required: "Refusing to pay: this Payrails save would keep the card on file without your consent. Nothing was sent.";
|
|
18
|
+
payrails_key_invalid: string;
|
|
19
|
+
payrails_key_mismatch: string;
|
|
20
|
+
payrails_token_invalid: string;
|
|
21
|
+
payrails_workspace_unpinned: string;
|
|
22
|
+
payrails_workspace_mismatch: string;
|
|
23
|
+
payrails_session_expiring: "Refusing to pay: this Payrails session expires before it can be approved. Reload the checkout.";
|
|
24
|
+
}>;
|
|
25
|
+
declare function payrailsRefusalMessage(code: any): any;
|
|
26
|
+
declare function base64UrlEncode(bytes: any): string;
|
|
27
|
+
declare function base64UrlDecode(text: any, max: any): Uint8Array<ArrayBuffer> | null;
|
|
28
|
+
declare function isPayrailsSaveUrl(url: any, { exact: exact2 }?: {
|
|
29
|
+
exact?: boolean | undefined;
|
|
30
|
+
}): boolean;
|
|
31
|
+
declare function payrailsJweParts(jwe: any): {
|
|
32
|
+
wrappedKey: Uint8Array<ArrayBuffer>;
|
|
33
|
+
iv: Uint8Array<ArrayBuffer>;
|
|
34
|
+
ciphertext: Uint8Array<ArrayBuffer>;
|
|
35
|
+
tag: Uint8Array<ArrayBuffer>;
|
|
36
|
+
} | null;
|
|
37
|
+
declare function payrailsTemplateRefusal(body: any): any;
|
|
38
|
+
declare function parsePayrailsSave(body: any): any;
|
|
39
|
+
declare function payrailsKeepsCardFor(save: any): any;
|
|
40
|
+
declare function payrailsCardOnFileRefusal(body: any): any;
|
|
41
|
+
declare function classifyPayrailsRequest(url: any, method: any, body: any): "card" | "continue" | null;
|
|
42
|
+
declare function payrailsAuthorizeCarriesCard(url: any, method: any, body: any): boolean;
|
|
43
|
+
declare function payrailsSessionKeyBytes(spki: any): any;
|
|
44
|
+
declare function payrailsSessionKeyRefusal(spki: any, body: any): any;
|
|
45
|
+
declare function payrailsTokenClaims(authorization: any): Readonly<{
|
|
46
|
+
claims: Readonly<{}>;
|
|
47
|
+
exp: any;
|
|
48
|
+
}> | null;
|
|
49
|
+
declare function payrailsWorkspacePinRefusal(authorization: any, pin: any, now?: number): "payrails_workspace_unpinned" | "payrails_token_invalid" | "payrails_workspace_mismatch" | "payrails_session_expiring" | null;
|
|
50
|
+
declare var PAYRAILS_USABLE_STATUSES: readonly string[];
|
|
51
|
+
declare var PAYRAILS_UNUSABLE_STATUSES: readonly string[];
|
|
52
|
+
declare var PAYRAILS_SERVED_CARD_FACTS: readonly string[];
|
|
53
|
+
declare function payrailsFacts(text: any): {
|
|
54
|
+
refusalCode: any;
|
|
55
|
+
};
|
|
56
|
+
declare function sanitizePayrailsResponse(text: any): string;
|
|
57
|
+
declare function payrailsResponseOutcome(status: any, text: any, { card }?: {}): {
|
|
58
|
+
outcome: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
code?: undefined;
|
|
61
|
+
body?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
outcome: string;
|
|
64
|
+
code: any;
|
|
65
|
+
reason?: undefined;
|
|
66
|
+
body?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
outcome: string;
|
|
69
|
+
body: string;
|
|
70
|
+
reason?: undefined;
|
|
71
|
+
code?: undefined;
|
|
72
|
+
};
|
|
73
|
+
export { PAYRAILS_CAPABILITY, PAYRAILS_CARD_ON_FILE_CONSENTED, PAYRAILS_FUTURE_USAGES, PAYRAILS_JWE_HEADER, PAYRAILS_JWE_HEADER_B64, PAYRAILS_KEY_BITS, PAYRAILS_OPERATION, PAYRAILS_PSP, PAYRAILS_REFUSALS, PAYRAILS_SAVE_HOSTS, PAYRAILS_SAVE_PATH, PAYRAILS_SERVED_CARD_FACTS, PAYRAILS_SESSION_MIN_SECONDS, PAYRAILS_UNUSABLE_STATUSES, PAYRAILS_USABLE_STATUSES, base64UrlDecode, base64UrlEncode, classifyPayrailsRequest, isPayrailsSaveUrl, parsePayrailsSave, payrailsAuthorizeCarriesCard, payrailsCardOnFileRefusal, payrailsFacts, payrailsJweParts, payrailsKeepsCardFor, payrailsRefusalMessage, payrailsResponseOutcome, payrailsSessionKeyBytes, payrailsSessionKeyRefusal, payrailsTemplateRefusal, payrailsTokenClaims, payrailsWorkspacePinRefusal, sanitizePayrailsResponse };
|