diff options
author | Matthew Miller <matthew@millerti.me> | 2020-06-01 17:10:58 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2020-06-01 17:10:58 -0700 |
commit | 344ba5cec132724bf558b0a0c3b8e78e74624c7a (patch) | |
tree | 77cd3f7df4b15e83ded750e2a8b81715a36e4b36 /packages/typescript-types/src | |
parent | c3d641b547124cca168bf9b02ab43acc3885cf5f (diff) |
Move some enums and types out of types package
Diffstat (limited to 'packages/typescript-types/src')
-rw-r--r-- | packages/typescript-types/src/index.ts | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index a1d93e0..40dd4dd 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -92,124 +92,6 @@ interface AuthenticatorAssertionResponseJSON userHandle?: Base64String; } -export enum ATTESTATION_FORMATS { - FIDO_U2F = 'fido-u2f', - PACKED = 'packed', - ANDROID_SAFETYNET = 'android-safetynet', - NONE = 'none', -} - -export type AttestationObject = { - fmt: ATTESTATION_FORMATS; - attStmt: { - sig?: Buffer; - x5c?: Buffer[]; - response?: Buffer; - }; - authData: Buffer; -}; - -export type ParsedAuthenticatorData = { - rpIdHash: Buffer; - flagsBuf: Buffer; - flags: { - up: boolean; - uv: boolean; - at: boolean; - ed: boolean; - flagsInt: number; - }; - counter: number; - counterBuf: Buffer; - aaguid?: Buffer; - credentialID?: Buffer; - COSEPublicKey?: Buffer; -}; - -export type ClientDataJSON = { - type: string; - challenge: string; - origin: string; -}; - -/** - * Result of attestation verification - * - * @param verified If the assertion response could be verified - * @param userVerified Whether the user was uniquely identified during attestation - * @param authenticatorInfo.fmt Type of attestation - * @param authenticatorInfo.counter The number of times the authenticator reported it has been used. - * Should be kept in a DB for later reference to help prevent replay attacks - * @param authenticatorInfo.base64PublicKey Base64-encoded ArrayBuffer containing the - * authenticator's public key. **Should be kept in a DB for later reference!** - * @param authenticatorInfo.base64CredentialID Base64-encoded ArrayBuffer containing the - * authenticator's credential ID for the public key above. **Should be kept in a DB for later - * reference!** - */ -export type VerifiedAttestation = { - verified: boolean; - userVerified: boolean; - authenticatorInfo?: { - fmt: ATTESTATION_FORMATS; - counter: number; - base64PublicKey: string; - base64CredentialID: string; - }; -}; - -/** - * Result of assertion verification - * - * @param verified If the assertion response could be verified - * @param authenticatorInfo.base64CredentialID The ID of the authenticator used during assertion. - * Should be used to identify which DB authenticator entry needs its `counter` updated to the value - * below - * @param authenticatorInfo.counter The number of times the authenticator identified above reported - * it has been used. **Should be kept in a DB for later reference to help prevent replay attacks!** - */ -export type VerifiedAssertion = { - verified: boolean; - authenticatorInfo: { - counter: number; - base64CredentialID: string; - }; -}; - -export type CertificateInfo = { - subject: { [key: string]: string }; - version: number; - basicConstraintsCA: boolean; -}; - -export enum COSEKEYS { - kty = 1, - alg = 3, - crv = -1, - x = -2, - y = -3, - n = -1, - e = -2, -} - -export type COSEPublicKey = Map<COSEAlgorithmIdentifier, number | Buffer>; - -export type SafetyNetJWTHeader = { - alg: 'string'; - x5c: string[]; -}; - -export type SafetyNetJWTPayload = { - nonce: string; - timestampMs: number; - apkPackageName: string; - apkDigestSha256: string; - ctsProfileMatch: boolean; - apkCertificateDigestSha256: string[]; - basicIntegrity: boolean; -}; - -export type SafetyNetJWTSignature = string; - /** * A WebAuthn-compatible device and the information needed to verify assertions by it */ |