@plainkey/browser 0.1.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.
@@ -0,0 +1,101 @@
1
+ import { AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/browser";
2
+ import { PublicUser, UserIdentifier } from "@plainkey/types";
3
+
4
+ //#region src/types/requests.d.ts
5
+ type RegistrationBeginRequest = {
6
+ userName?: string;
7
+ userMetadata?: Record<string, unknown>;
8
+ };
9
+ type RegistrationCompleteRequest = {
10
+ userIdentifier: UserIdentifier;
11
+ credential: RegistrationResponseJSON;
12
+ };
13
+ type UserCredentialBeginRequest = {
14
+ userIdentifier: UserIdentifier;
15
+ };
16
+ type UserCredentialCompleteRequest = {
17
+ userIdentifier: UserIdentifier;
18
+ credential: RegistrationResponseJSON;
19
+ };
20
+ type LoginBeginRequest = {
21
+ userIdentifier?: UserIdentifier;
22
+ };
23
+ type LoginCompleteRequest = {
24
+ authenticationResponse: AuthenticationResponseJSON;
25
+ };
26
+ //#endregion
27
+ //#region src/types/responses.d.ts
28
+ type ErrorResponse = {
29
+ error: string;
30
+ };
31
+ type RegistrationBeginResponse = {
32
+ user: PublicUser;
33
+ options: PublicKeyCredentialCreationOptionsJSON;
34
+ };
35
+ type IssuedSession = {
36
+ sessionId: string;
37
+ token: string;
38
+ expiresInSeconds: number;
39
+ tokenType: string;
40
+ refreshToken: string;
41
+ };
42
+ type RegistrationCompleteResponse = {
43
+ success: boolean;
44
+ user: PublicUser;
45
+ token: IssuedSession;
46
+ credential: {
47
+ id: string;
48
+ webAuthnId: string;
49
+ };
50
+ };
51
+ type UserCredentialBeginResponse = {
52
+ user: PublicUser;
53
+ options: PublicKeyCredentialCreationOptionsJSON;
54
+ };
55
+ type UserCredentialCompleteResponse = {
56
+ success: boolean;
57
+ user: PublicUser;
58
+ token: IssuedSession;
59
+ credential: {
60
+ id: string;
61
+ webAuthnId: string;
62
+ };
63
+ };
64
+ type LoginBeginResponse = {
65
+ projectId: string;
66
+ userId?: string;
67
+ options: PublicKeyCredentialRequestOptionsJSON;
68
+ };
69
+ type LoginCompleteResponse = {
70
+ verified: boolean;
71
+ user: PublicUser;
72
+ token: IssuedSession;
73
+ };
74
+ //#endregion
75
+ //#region src/plainkey-client.d.ts
76
+ type PlainKeyClientParams = {
77
+ clientId: string;
78
+ baseUrl?: string;
79
+ };
80
+ declare class PlainKeyClient {
81
+ private readonly clientId;
82
+ private readonly baseUrl;
83
+ constructor(clientParams: PlainKeyClientParams);
84
+ /**
85
+ * Registration of a new user with passkey.
86
+ * Creates a new user and adds a credential to it.
87
+ */
88
+ Registration(beginParams: RegistrationBeginRequest): Promise<RegistrationCompleteResponse>;
89
+ /**
90
+ * Add credential to existing user.
91
+ * Requires valid user authentication token (log user in first which will set a user token cookie, then call this).
92
+ */
93
+ AddCredential(beginParams: UserCredentialBeginRequest): Promise<UserCredentialCompleteResponse>;
94
+ /**
95
+ * Performs a login ceremony.
96
+ */
97
+ Login(beginParams: LoginBeginRequest): Promise<LoginCompleteResponse>;
98
+ }
99
+ //#endregion
100
+ export { ErrorResponse, IssuedSession, LoginBeginRequest, LoginBeginResponse, LoginCompleteRequest, LoginCompleteResponse, PlainKeyClient, PlainKeyClientParams, RegistrationBeginRequest, RegistrationBeginResponse, RegistrationCompleteRequest, RegistrationCompleteResponse, UserCredentialBeginRequest, UserCredentialBeginResponse, UserCredentialCompleteRequest, UserCredentialCompleteResponse };
101
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/requests.ts","../src/types/responses.ts","../src/plainkey-client.ts"],"sourcesContent":[],"mappings":";;;;KAIY,wBAAA;;EAAA,YAAA,CAAA,EAEK,MAFL,CAAA,MAAwB,EAAA,OAEnB,CAAA;AAGjB,CAAA;AAAuC,KAA3B,2BAAA,GAA2B;gBACrB,EAA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WAAA,CAAA,YAAA,EEwBV,oBFxBU;EAI1B;AAIZ;;;cAEc,CAAA,WAAA,EEyBoB,wBFzBpB,CAAA,EEyB+C,OFzB/C,CEyBuD,4BFzBvD,CAAA;EAAwB;AAItC;AAIA;;6BE4EiB,6BACZ,QAAQ;;ADnGb;AAKA;EAAqC,KAAA,CAAA,WAAA,ECuJV,iBDvJU,CAAA,ECuJU,ODvJV,CCuJkB,qBDvJlB,CAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,137 @@
1
+ import { startAuthentication, startRegistration } from "@simplewebauthn/browser";
2
+
3
+ //#region src/plainkey-client.ts
4
+ var PlainKeyClient = class {
5
+ constructor(clientParams) {
6
+ const { clientId, baseUrl = "https://api.plainkey.io" } = clientParams;
7
+ this.clientId = clientId;
8
+ this.baseUrl = baseUrl.replace(/\/$/, "");
9
+ }
10
+ /**
11
+ * Registration of a new user with passkey.
12
+ * Creates a new user and adds a credential to it.
13
+ */
14
+ async Registration(beginParams) {
15
+ const headers = new Headers({
16
+ "Content-Type": "application/json",
17
+ "client-id": this.clientId
18
+ });
19
+ const beginResponse = await fetch(`${this.baseUrl}/user/register/begin`, {
20
+ method: "POST",
21
+ headers,
22
+ credentials: "include",
23
+ body: JSON.stringify(beginParams)
24
+ });
25
+ if (!beginResponse.ok) {
26
+ const errorData = await beginResponse.json();
27
+ throw new Error(errorData.error);
28
+ }
29
+ const { options, user } = await beginResponse.json();
30
+ const credential = await startRegistration({ optionsJSON: options });
31
+ const completeParams = {
32
+ userIdentifier: { userId: user.id },
33
+ credential
34
+ };
35
+ const completeResponse = await fetch(`${this.baseUrl}/user/register/complete`, {
36
+ method: "POST",
37
+ headers: {
38
+ "Content-Type": "application/json",
39
+ "client-id": this.clientId
40
+ },
41
+ credentials: "include",
42
+ body: JSON.stringify(completeParams)
43
+ });
44
+ if (!completeResponse.ok) {
45
+ const errorData = await completeResponse.json();
46
+ throw new Error(errorData.error);
47
+ }
48
+ const response = await completeResponse.json();
49
+ if (!response) throw new Error("No registration response from server");
50
+ return response;
51
+ }
52
+ /**
53
+ * Add credential to existing user.
54
+ * Requires valid user authentication token (log user in first which will set a user token cookie, then call this).
55
+ */
56
+ async AddCredential(beginParams) {
57
+ const headers = new Headers({
58
+ "Content-Type": "application/json",
59
+ "client-id": this.clientId
60
+ });
61
+ const beginResponse = await fetch(`${this.baseUrl}/user/credential/begin`, {
62
+ method: "POST",
63
+ headers,
64
+ credentials: "include",
65
+ body: JSON.stringify(beginParams)
66
+ });
67
+ if (!beginResponse.ok) {
68
+ const errorData = await beginResponse.json();
69
+ throw new Error(errorData.error);
70
+ }
71
+ const { options, user } = await beginResponse.json();
72
+ const credential = await startRegistration({ optionsJSON: options });
73
+ const completeParams = {
74
+ userIdentifier: { userId: user.id },
75
+ credential
76
+ };
77
+ const completeResponse = await fetch(`${this.baseUrl}/user/credential/complete`, {
78
+ method: "POST",
79
+ headers: {
80
+ "Content-Type": "application/json",
81
+ "client-id": this.clientId
82
+ },
83
+ credentials: "include",
84
+ body: JSON.stringify(completeParams)
85
+ });
86
+ if (!completeResponse.ok) {
87
+ const errorData = await completeResponse.json();
88
+ throw new Error(errorData.error);
89
+ }
90
+ const response = await completeResponse.json();
91
+ if (!response) throw new Error("No credential registration response from server");
92
+ return response;
93
+ }
94
+ /**
95
+ * Performs a login ceremony.
96
+ */
97
+ async Login(beginParams) {
98
+ const beginResponse = await fetch(`${this.baseUrl}/login/begin`, {
99
+ method: "POST",
100
+ headers: {
101
+ "Content-Type": "application/json",
102
+ "client-id": this.clientId
103
+ },
104
+ credentials: "include",
105
+ body: JSON.stringify(beginParams)
106
+ });
107
+ if (!beginResponse.ok) {
108
+ const errorData = await beginResponse.json();
109
+ throw new Error(errorData.error);
110
+ }
111
+ const beginResponseData = await beginResponse.json();
112
+ if (!beginResponseData.options) throw new Error("No options found in login begin response");
113
+ const authenticationResponse = await startAuthentication({ optionsJSON: beginResponseData.options });
114
+ if (!authenticationResponse) throw new Error("No authentication response from browser");
115
+ const completeParams = { authenticationResponse };
116
+ const verificationResponse = await fetch(`${this.baseUrl}/login/complete`, {
117
+ method: "POST",
118
+ headers: {
119
+ "Content-Type": "application/json",
120
+ "client-id": this.clientId
121
+ },
122
+ credentials: "include",
123
+ body: JSON.stringify(completeParams)
124
+ });
125
+ if (!verificationResponse.ok) {
126
+ const errorData = await verificationResponse.json();
127
+ throw new Error(errorData.error);
128
+ }
129
+ const verificationResponseData = await verificationResponse.json();
130
+ if (!verificationResponseData) throw new Error("No login verification response from server");
131
+ return verificationResponseData;
132
+ }
133
+ };
134
+
135
+ //#endregion
136
+ export { PlainKeyClient };
137
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["errorData: ErrorResponse","credential: RegistrationResponseJSON","completeParams: RegistrationCompleteRequest","response: RegistrationCompleteResponse","completeParams: UserCredentialCompleteRequest","response: UserCredentialCompleteResponse","beginResponseData: LoginBeginResponse","authenticationResponse: AuthenticationResponseJSON","completeParams: LoginCompleteRequest","verificationResponseData: LoginCompleteResponse"],"sources":["../src/plainkey-client.ts"],"sourcesContent":["import { startAuthentication, startRegistration } from \"@simplewebauthn/browser\"\r\nimport { RegistrationResponseJSON, AuthenticationResponseJSON } from \"@simplewebauthn/browser\"\r\n\r\nimport type {\r\n RegistrationBeginRequest,\r\n RegistrationCompleteRequest,\r\n UserCredentialBeginRequest,\r\n UserCredentialCompleteRequest,\r\n LoginBeginRequest,\r\n LoginCompleteRequest\r\n} from \"./types/requests\"\r\n\r\nimport type {\r\n RegistrationBeginResponse,\r\n RegistrationCompleteResponse,\r\n UserCredentialBeginResponse,\r\n UserCredentialCompleteResponse,\r\n LoginBeginResponse,\r\n LoginCompleteResponse,\r\n ErrorResponse\r\n} from \"./types/responses\"\r\n\r\nexport type PlainKeyClientParams = {\r\n // The client ID tied to the project.\r\n clientId: string\r\n\r\n // The base URL of the PlainKey API.\r\n baseUrl?: string\r\n}\r\n\r\n// TODO: Account for errors like this: \"Unexpected token 'R', \"Response v\"... is not valid JSON\"\r\nexport class PlainKeyClient {\r\n private readonly clientId: string\r\n private readonly baseUrl: string\r\n\r\n constructor(clientParams: PlainKeyClientParams) {\r\n const { clientId, baseUrl = \"https://api.plainkey.io\" } = clientParams\r\n\r\n this.clientId = clientId\r\n this.baseUrl = baseUrl.replace(/\\/$/, \"\") // Remove trailing slash\r\n }\r\n\r\n /**\r\n * Registration of a new user with passkey.\r\n * Creates a new user and adds a credential to it.\r\n */\r\n async Registration(beginParams: RegistrationBeginRequest): Promise<RegistrationCompleteResponse> {\r\n // Step 1: Get registration options from server\r\n const headers = new Headers({\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n })\r\n\r\n const beginResponse = await fetch(`${this.baseUrl}/user/register/begin`, {\r\n method: \"POST\",\r\n headers,\r\n credentials: \"include\",\r\n body: JSON.stringify(beginParams)\r\n })\r\n\r\n if (!beginResponse.ok) {\r\n const errorData: ErrorResponse = await beginResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n const { options, user } = (await beginResponse.json()) as RegistrationBeginResponse\r\n\r\n // Step 2: Create credential using browser's WebAuthn API\r\n const credential: RegistrationResponseJSON = await startRegistration({\r\n optionsJSON: options\r\n })\r\n\r\n // Step 3: Send credential to server for verification\r\n const completeParams: RegistrationCompleteRequest = {\r\n userIdentifier: { userId: user.id },\r\n credential\r\n }\r\n\r\n const completeResponse = await fetch(`${this.baseUrl}/user/register/complete`, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n },\r\n credentials: \"include\",\r\n body: JSON.stringify(completeParams)\r\n })\r\n\r\n if (!completeResponse.ok) {\r\n const errorData: ErrorResponse = await completeResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n // Intentionally not throwing errors on verification failure - UI should handle this.\r\n const response: RegistrationCompleteResponse = await completeResponse.json()\r\n if (!response) throw new Error(\"No registration response from server\")\r\n\r\n return response\r\n }\r\n\r\n /**\r\n * Add credential to existing user.\r\n * Requires valid user authentication token (log user in first which will set a user token cookie, then call this).\r\n */\r\n async AddCredential(\r\n beginParams: UserCredentialBeginRequest\r\n ): Promise<UserCredentialCompleteResponse> {\r\n // Step 1: Get credential registration options from server\r\n const headers = new Headers({\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n })\r\n\r\n const beginResponse = await fetch(`${this.baseUrl}/user/credential/begin`, {\r\n method: \"POST\",\r\n headers,\r\n credentials: \"include\",\r\n body: JSON.stringify(beginParams)\r\n })\r\n\r\n if (!beginResponse.ok) {\r\n const errorData: ErrorResponse = await beginResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n const { options, user } = (await beginResponse.json()) as UserCredentialBeginResponse\r\n\r\n // Step 2: Create credential using browser's WebAuthn API\r\n const credential: RegistrationResponseJSON = await startRegistration({\r\n optionsJSON: options\r\n })\r\n\r\n // Step 3: Send credential to server for verification\r\n const completeParams: UserCredentialCompleteRequest = {\r\n userIdentifier: { userId: user.id },\r\n credential\r\n }\r\n\r\n const completeResponse = await fetch(`${this.baseUrl}/user/credential/complete`, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n },\r\n credentials: \"include\",\r\n body: JSON.stringify(completeParams)\r\n })\r\n\r\n if (!completeResponse.ok) {\r\n const errorData: ErrorResponse = await completeResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n // Intentionally not throwing errors on verification failure - UI should handle this.\r\n const response: UserCredentialCompleteResponse = await completeResponse.json()\r\n if (!response) throw new Error(\"No credential registration response from server\")\r\n\r\n return response\r\n }\r\n\r\n /**\r\n * Performs a login ceremony.\r\n */\r\n async Login(beginParams: LoginBeginRequest): Promise<LoginCompleteResponse> {\r\n // Step 1: Get authentication options from server\r\n const beginResponse = await fetch(`${this.baseUrl}/login/begin`, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n },\r\n credentials: \"include\",\r\n body: JSON.stringify(beginParams)\r\n })\r\n\r\n if (!beginResponse.ok) {\r\n const errorData: ErrorResponse = await beginResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n const beginResponseData: LoginBeginResponse = await beginResponse.json()\r\n if (!beginResponseData.options) {\r\n throw new Error(\"No options found in login begin response\")\r\n }\r\n\r\n // Step 2: Pass options to the authenticator and wait for response\r\n const authenticationResponse: AuthenticationResponseJSON = await startAuthentication({\r\n optionsJSON: beginResponseData.options\r\n })\r\n\r\n if (!authenticationResponse) {\r\n throw new Error(\"No authentication response from browser\")\r\n }\r\n\r\n // Step 3: POST the response to the server\r\n const completeParams: LoginCompleteRequest = { authenticationResponse }\r\n\r\n const verificationResponse = await fetch(`${this.baseUrl}/login/complete`, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"client-id\": this.clientId\r\n },\r\n credentials: \"include\",\r\n body: JSON.stringify(completeParams)\r\n })\r\n\r\n if (!verificationResponse.ok) {\r\n const errorData: ErrorResponse = await verificationResponse.json()\r\n throw new Error(errorData.error)\r\n }\r\n\r\n // Intentionally not throwing errors on verification failure - UI should handle this.\r\n const verificationResponseData: LoginCompleteResponse = await verificationResponse.json()\r\n if (!verificationResponseData) throw new Error(\"No login verification response from server\")\r\n\r\n return verificationResponseData\r\n }\r\n}\r\n"],"mappings":";;;AA+BA,IAAa,iBAAb,MAA4B;CAI1B,YAAY,cAAoC;EAC9C,MAAM,EAAE,UAAU,UAAU,8BAA8B;AAE1D,OAAK,WAAW;AAChB,OAAK,UAAU,QAAQ,QAAQ,OAAO,GAAG;;;;;;CAO3C,MAAM,aAAa,aAA8E;EAE/F,MAAM,UAAU,IAAI,QAAQ;GAC1B,gBAAgB;GAChB,aAAa,KAAK;GACnB,CAAC;EAEF,MAAM,gBAAgB,MAAM,MAAM,GAAG,KAAK,QAAQ,uBAAuB;GACvE,QAAQ;GACR;GACA,aAAa;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AM,IAAI,MAAM,UAAU,MAAM;;EAIlC,MAAMS,2BAAkD,MAAM,qBAAqB,MAAM;AACzF,MAAI,CAAC,yBAA0B,OAAM,IAAI,MAAM,6CAA6C;AAE5F,SAAO"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@plainkey/browser",
3
+ "version": "0.1.0",
4
+ "description": "PlainKey TypeScript browser SDK",
5
+ "module": "dist/index.mjs",
6
+ "types": "dist/index.d.mts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.mts",
10
+ "import": "./dist/index.mjs"
11
+ }
12
+ },
13
+ "sideEffects": false,
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsdown src/index.ts --format esm --dts --sourcemap --clean",
19
+ "test": "vitest",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "dependencies": {
26
+ "@plainkey/types": "*",
27
+ "@simplewebauthn/browser": "^13.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "tsdown": "^0.15.5"
31
+ }
32
+ }