diff options
author | Matthew Miller <matthew@millerti.me> | 2020-05-25 11:50:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-25 11:50:22 -0700 |
commit | d0205b9a4f2b4e304447e8072e4384f52dcc0c51 (patch) | |
tree | f68fe8f67d53efb6faa84d8e35c25a65b315507a /packages/typescript-types/src | |
parent | 2cda08e3fc9935eff5613f08c7f9e4a30cf19c85 (diff) | |
parent | 5ef053d8785afc0cc25936add1b9b9097efbe45e (diff) |
Merge pull request #10 from MasterKale/feature/linting
feature/linting
Diffstat (limited to 'packages/typescript-types/src')
-rw-r--r-- | packages/typescript-types/src/index.ts | 157 |
1 files changed, 80 insertions, 77 deletions
diff --git a/packages/typescript-types/src/index.ts b/packages/typescript-types/src/index.ts index 9e5ec5d..cab623c 100644 --- a/packages/typescript-types/src/index.ts +++ b/packages/typescript-types/src/index.ts @@ -9,24 +9,26 @@ */ export type PublicKeyCredentialCreationOptionsJSON = { publicKey: { - challenge: string, + challenge: string; // The organization registering and authenticating the user rp: { - name: string, - id: string, - }, + name: string; + id: string; + }; user: { - id: string, - name: string, - displayName: string, - }, - pubKeyCredParams: [{ - alg: -7, - type: 'public-key', - }], - timeout?: number, - attestation: 'direct' | 'indirect', - }, + id: string; + name: string; + displayName: string; + }; + pubKeyCredParams: [ + { + alg: -7; + type: 'public-key'; + }, + ]; + timeout?: number; + attestation: 'direct' | 'indirect'; + }; }; /** @@ -41,18 +43,18 @@ export type PublicKeyCredentialCreationOptionsJSON = { export type PublicKeyCredentialRequestOptionsJSON = { publicKey: { // - challenge: string, + challenge: string; allowCredentials: { // Will be converted to a Uint8Array in the browser - id: string, - type: 'public-key', - transports?: AuthenticatorTransport[], - }[], + id: string; + type: 'public-key'; + transports?: AuthenticatorTransport[]; + }[]; // extensions?: AuthenticationExtensionsClientInputs, - rpId?: string, - timeout?: number, - userVerification?: UserVerificationRequirement, - }, + rpId?: string; + timeout?: number; + userVerification?: UserVerificationRequirement; + }; }; /** @@ -73,10 +75,9 @@ export interface AssertionCredential extends PublicKeyCredential { * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that * are base64-encoded in the browser so that they can be sent as JSON to the server. */ -export interface AuthenticatorAttestationResponseJSON extends Omit< -AuthenticatorAttestationResponse, 'clientDataJSON' | 'attestationObject' -> { - base64ClientDataJSON: string, +export interface AuthenticatorAttestationResponseJSON + extends Omit<AuthenticatorAttestationResponse, 'clientDataJSON' | 'attestationObject'> { + base64ClientDataJSON: string; base64AttestationObject: string; } @@ -84,9 +85,11 @@ AuthenticatorAttestationResponse, 'clientDataJSON' | 'attestationObject' * A slightly-modified AuthenticatorAttestationResponse to simplify working with ArrayBuffers that * are base64-encoded in the browser so that they can be sent as JSON to the server. */ -export interface AuthenticatorAssertionResponseJSON extends Omit< -AuthenticatorAssertionResponse, 'clientDataJSON' | 'authenticatorData' | 'signature' | 'userHandle' -> { +export interface AuthenticatorAssertionResponseJSON + extends Omit< + AuthenticatorAssertionResponse, + 'clientDataJSON' | 'authenticatorData' | 'signature' | 'userHandle' + > { base64CredentialID: string; base64AuthenticatorData: string; base64ClientDataJSON: string; @@ -102,36 +105,36 @@ export enum ATTESTATION_FORMATS { } export type AttestationObject = { - fmt: ATTESTATION_FORMATS, + fmt: ATTESTATION_FORMATS; attStmt: { - sig?: Buffer, - x5c?: Buffer[], - response?: Buffer, - }, - authData: Buffer, + sig?: Buffer; + x5c?: Buffer[]; + response?: Buffer; + }; + authData: Buffer; }; export type ParsedAuthenticatorData = { - rpIdHash: Buffer, - flagsBuf: Buffer, + 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, + 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, + type: string; + challenge: string; + origin: string; }; /** @@ -149,14 +152,14 @@ export type ClientDataJSON = { * reference!** */ export type VerifiedAttestation = { - verified: boolean, + verified: boolean; userVerified: boolean; authenticatorInfo?: { - fmt: ATTESTATION_FORMATS, - counter: number, - base64PublicKey: string, - base64CredentialID: string, - }, + fmt: ATTESTATION_FORMATS; + counter: number; + base64PublicKey: string; + base64CredentialID: string; + }; }; /** @@ -172,15 +175,15 @@ export type VerifiedAttestation = { export type VerifiedAssertion = { verified: boolean; authenticatorInfo: { - counter: number, - base64CredentialID: string, - }, + counter: number; + base64CredentialID: string; + }; }; export type CertificateInfo = { - subject: { [key: string]: string }, - version: number, - basicConstraintsCA: boolean, + subject: { [key: string]: string }; + version: number; + basicConstraintsCA: boolean; }; export enum COSEKEYS { @@ -196,18 +199,18 @@ export enum COSEKEYS { export type COSEPublicKey = Map<COSEAlgorithmIdentifier, number | Buffer>; export type SafetyNetJWTHeader = { - alg: 'string', - x5c: string[], + alg: 'string'; + x5c: string[]; }; export type SafetyNetJWTPayload = { - nonce: string, - timestampMs: number, - apkPackageName: string, - apkDigestSha256: string, - ctsProfileMatch: boolean, - apkCertificateDigestSha256: string[], - basicIntegrity: boolean, + nonce: string; + timestampMs: number; + apkPackageName: string; + apkDigestSha256: string; + ctsProfileMatch: boolean; + apkCertificateDigestSha256: string[]; + basicIntegrity: boolean; }; export type SafetyNetJWTSignature = string; @@ -216,8 +219,8 @@ export type SafetyNetJWTSignature = string; * A WebAuthn-compatible device and the information needed to verify assertions by it */ export type AuthenticatorDevice = { - base64PublicKey: string, - base64CredentialID: string, + base64PublicKey: string; + base64CredentialID: string; // Number of times this device is expected to have been used - counter: number, + counter: number; }; |