-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1df5f81
commit 2ecc45d
Showing
14 changed files
with
813 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { | ||
PublicKeyCredentialRequestOptionsJSON, | ||
AuthenticationResponseJSON, | ||
Base64URLString, PublicKeyCredentialDescriptorJSON, PublicKeyCredentialJSON | ||
} from "@simplewebauthn/typescript-types"; | ||
import { | ||
AuthenticationExtensionsClientInputs, | ||
UserVerificationRequirement | ||
} from "@simplewebauthn/typescript-types/dist/dom"; | ||
|
||
export interface PaymentRequestInstrument { | ||
displayName: string; | ||
icon: string; | ||
iconMustBeShown?: boolean; | ||
} | ||
|
||
export interface PaymentRequestDataJSON { | ||
challenge: Base64URLString; | ||
timeout?: number; | ||
rpId?: string; | ||
allowCredentials?: PublicKeyCredentialDescriptorJSON[]; | ||
instrument: PaymentRequestInstrument; | ||
payeeOrigin: string; | ||
} | ||
|
||
export interface PartialPaymentRequestDataJSON extends Partial<Omit<PaymentRequestDataJSON, "instrument">> { | ||
instrument?: Partial<PaymentRequestInstrument>; | ||
} | ||
|
||
export interface PaymentRequestOptionsJSON { | ||
data: PaymentRequestDataJSON; | ||
details: PaymentDetailsInit; | ||
} | ||
|
||
export interface PartialPaymentRequestOptionsJSON { | ||
data?: PartialPaymentRequestDataJSON; | ||
details?: Partial<PaymentDetailsInit>; | ||
} | ||
|
||
export interface PaymentResponseJSON { | ||
details: AuthenticationResponseJSON | ||
methodName: string; | ||
payerEmail?: string; | ||
payerName?: string; | ||
payerPhone?: string; | ||
requestId: string; | ||
shippingAddress?: unknown; | ||
shippingOption?: unknown; | ||
} | ||
|
||
/* | ||
{ | ||
// The RP ID | ||
rpId: location.hostname, | ||
// List of credential IDs obtained from the RP server. | ||
credentialIds: credentialIds.flatMap(value => value.split("_")).map(base64ToArrayBuffer), | ||
// The challenge is also obtained from the RP server. | ||
challenge: base64ToArrayBuffer(challenge), | ||
// A display name and an icon that represent the payment instrument. | ||
instrument: { | ||
displayName: paymentMethodName, | ||
// Transparent-black pixel. | ||
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==", | ||
iconMustBeShown: false | ||
}, | ||
// The origin of the payee (merchant) | ||
payeeOrigin: payeeOrigin || location.origin, | ||
// The number of milliseconds to timeout. | ||
timeout: 360000, // 6 minutes | ||
} | ||
*/ |
Oops, something went wrong.