diff --git a/src/classes/Auth/Auth.ts b/src/classes/Auth/Auth.ts index 213b01a..649882e 100644 --- a/src/classes/Auth/Auth.ts +++ b/src/classes/Auth/Auth.ts @@ -26,6 +26,14 @@ export class Auth extends PassageBase { * @return {Promise} The transaction ID */ public async createRegisterTransaction(externalId: string, passkeyDisplayName: string): Promise { + if (!externalId) { + throw new Error('externalId is required.'); + } + + if (!passkeyDisplayName) { + throw new Error('passkeyDisplayName is required.'); + } + try { const response = await this.transactionClient.createRegisterTransaction({ appId: this.config.appId, @@ -48,6 +56,10 @@ export class Auth extends PassageBase { * @return {Promise} The transaction ID */ public async createAuthenticateTransaction(externalId: string): Promise { + if (!externalId) { + throw new Error('externalId is required.'); + } + try { const response = await this.transactionClient.createAuthenticateTransaction({ appId: this.config.appId, @@ -67,6 +79,10 @@ export class Auth extends PassageBase { * @return {Promise} The unique identifier of the user associated with the nonce */ public async verifyNonce(nonce: string): Promise { + if (!nonce) { + throw new Error('nonce is required.'); + } + try { const response = await this.authClient.authenticateVerifyNonce({ appId: this.config.appId, diff --git a/src/classes/PassageFlex/PassageFlex.spec.ts b/src/classes/PassageFlex/PassageFlex.spec.ts index 0de71e3..0a6e9d3 100644 --- a/src/classes/PassageFlex/PassageFlex.spec.ts +++ b/src/classes/PassageFlex/PassageFlex.spec.ts @@ -24,7 +24,7 @@ describe('PassageFlex', () => { } as unknown as PassageFlexConfig; expect(() => new PassageFlex(config)).toThrow( - 'A Passage app ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.', + 'A Passage App ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.', ); }); @@ -35,7 +35,7 @@ describe('PassageFlex', () => { }; expect(() => new PassageFlex(config)).toThrow( - 'A Passage app ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.', + 'A Passage App ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.', ); }); diff --git a/src/classes/PassageFlex/PassageFlex.ts b/src/classes/PassageFlex/PassageFlex.ts index 58605ac..2958d12 100644 --- a/src/classes/PassageFlex/PassageFlex.ts +++ b/src/classes/PassageFlex/PassageFlex.ts @@ -17,7 +17,7 @@ export class PassageFlex { */ public constructor(config: PassageFlexConfig) { if (!config.appId) { - throw Error('A Passage app ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.'); + throw Error('A Passage App ID is required. Please include {appId: YOUR_APP_ID, apiKey: YOUR_APP_ID}.'); } if (!config.apiKey) { diff --git a/src/classes/User/User.ts b/src/classes/User/User.ts index 15be584..4c594af 100644 --- a/src/classes/User/User.ts +++ b/src/classes/User/User.ts @@ -82,6 +82,14 @@ export class User extends PassageBase { * @return {Promise} */ public async revokeDevice(externalId: string, deviceId: string): Promise { + if (!externalId) { + throw new Error('externalId is required.'); + } + + if (!deviceId) { + throw new Error('deviceId is required.'); + } + try { const user = await this.get(externalId); await this.deviceClient.deleteUserDevices({