@plainkey/browser 0.3.4 → 0.3.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/plainkey-client.ts"],"sourcesContent":[],"mappings":";;;KAsBY,oBAAA;EAAA,SAAA,EAAA,MAAA;EAMC,OAAA,CAAA,EAAA,MAAA;CAAc;AAIC,cAJf,cAAA,CAIe;mBAWM,SAAA;mBAAmC,OAAA;aAAR,CAAA,YAAA,EAXjC,oBAWiC;;;;;cAoGN,CAAA,WAAA,EApGrB,wBAoGqB,CAAA,EApGM,OAoGN,CApGc,4BAoGd,CAAA;;;;;;6BAjDtC,6BACZ,QAAQ;;;;qBAgDc,oBAAoB,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/plainkey-client.ts"],"sourcesContent":[],"mappings":";;;KAsBY,oBAAA;EAAA,SAAA,EAAA,MAAA;EAMC,OAAA,CAAA,EAAA,MAAA;CAAc;AAIC,cAJf,cAAA,CAIe;mBAWM,SAAA;mBAAmC,OAAA;aAAR,CAAA,YAAA,EAXjC,oBAWiC;;;;;cA+GN,CAAA,WAAA,EA/GrB,wBA+GqB,CAAA,EA/GM,OA+GN,CA/Gc,4BA+Gd,CAAA;;;;;;6BAvDtC,6BACZ,QAAQ;;;;qBAsDc,oBAAoB,QAAQ"}
package/dist/index.mjs CHANGED
@@ -14,7 +14,10 @@ var PlainKeyClient = class {
14
14
  async Registration(beginParams) {
15
15
  const beginResponse = await fetch(`${this.baseUrl}/user/register/begin`, {
16
16
  method: "POST",
17
- headers: { "Content-Type": "application/json" },
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ "x-project-id": this.projectId
20
+ },
18
21
  body: JSON.stringify(beginParams)
19
22
  });
20
23
  if (!beginResponse.ok) {
@@ -24,13 +27,15 @@ var PlainKeyClient = class {
24
27
  const { options, user } = await beginResponse.json();
25
28
  const credential = await startRegistration({ optionsJSON: options });
26
29
  const completeParams = {
27
- projectId: this.projectId,
28
30
  userIdentifier: { userId: user.id },
29
31
  credential
30
32
  };
31
33
  const completeResponse = await fetch(`${this.baseUrl}/user/register/complete`, {
32
34
  method: "POST",
33
- headers: { "Content-Type": "application/json" },
35
+ headers: {
36
+ "Content-Type": "application/json",
37
+ "x-project-id": this.projectId
38
+ },
34
39
  body: JSON.stringify(completeParams)
35
40
  });
36
41
  if (!completeResponse.ok) {
@@ -49,7 +54,10 @@ var PlainKeyClient = class {
49
54
  async AddCredential(beginParams) {
50
55
  const beginResponse = await fetch(`${this.baseUrl}/user/credential/begin`, {
51
56
  method: "POST",
52
- headers: { "Content-Type": "application/json" },
57
+ headers: {
58
+ "Content-Type": "application/json",
59
+ "x-project-id": this.projectId
60
+ },
53
61
  body: JSON.stringify(beginParams)
54
62
  });
55
63
  if (!beginResponse.ok) {
@@ -64,7 +72,10 @@ var PlainKeyClient = class {
64
72
  };
65
73
  const completeResponse = await fetch(`${this.baseUrl}/user/credential/complete`, {
66
74
  method: "POST",
67
- headers: { "Content-Type": "application/json" },
75
+ headers: {
76
+ "Content-Type": "application/json",
77
+ "x-project-id": this.projectId
78
+ },
68
79
  body: JSON.stringify(completeParams)
69
80
  });
70
81
  if (!completeResponse.ok) {
@@ -81,7 +92,10 @@ var PlainKeyClient = class {
81
92
  async Login(beginParams) {
82
93
  const beginResponse = await fetch(`${this.baseUrl}/login/begin`, {
83
94
  method: "POST",
84
- headers: { "Content-Type": "application/json" },
95
+ headers: {
96
+ "Content-Type": "application/json",
97
+ "x-project-id": this.projectId
98
+ },
85
99
  body: JSON.stringify(beginParams)
86
100
  });
87
101
  if (!beginResponse.ok) {
@@ -93,13 +107,15 @@ var PlainKeyClient = class {
93
107
  const authenticationResponse = await startAuthentication({ optionsJSON: beginResponseData.options });
94
108
  if (!authenticationResponse) throw new Error("No authentication response from browser");
95
109
  const completeParams = {
96
- projectId: this.projectId,
97
110
  loginSessionId: beginResponseData.loginSession.id,
98
111
  authenticationResponse
99
112
  };
100
113
  const verificationResponse = await fetch(`${this.baseUrl}/login/complete`, {
101
114
  method: "POST",
102
- headers: { "Content-Type": "application/json" },
115
+ headers: {
116
+ "Content-Type": "application/json",
117
+ "x-project-id": this.projectId
118
+ },
103
119
  body: JSON.stringify(completeParams)
104
120
  });
105
121
  if (!verificationResponse.ok) {
@@ -1 +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\"\nimport { RegistrationResponseJSON, AuthenticationResponseJSON } from \"@simplewebauthn/browser\"\n\nimport type {\n RegistrationBeginRequest,\n RegistrationCompleteRequest,\n UserCredentialBeginRequest,\n UserCredentialCompleteRequest,\n LoginBeginRequest,\n LoginCompleteRequest\n} from \"@plainkey/types\"\n\nimport type {\n RegistrationBeginResponse,\n RegistrationCompleteResponse,\n UserCredentialBeginResponse,\n UserCredentialCompleteResponse,\n LoginBeginResponse,\n LoginCompleteResponse,\n ErrorResponse\n} from \"@plainkey/types\"\n\nexport type PlainKeyClientParams = {\n projectId: string\n baseUrl?: string\n}\n\n// TODO: Account for errors like this: \"Unexpected token 'R', \"Response v\"... is not valid JSON\"\nexport class PlainKeyClient {\n private readonly projectId: string\n private readonly baseUrl: string\n\n constructor(clientParams: PlainKeyClientParams) {\n const { projectId, baseUrl = \"https://api.plainkey.io/api\" } = clientParams\n\n this.projectId = projectId\n this.baseUrl = baseUrl.replace(/\\/$/, \"\") // Remove trailing slash\n }\n\n /**\n * Registration of a new user with passkey.\n * Creates a new user and adds a credential to it.\n */\n async Registration(beginParams: RegistrationBeginRequest): Promise<RegistrationCompleteResponse> {\n // Step 1: Get registration options from server\n const beginResponse = await fetch(`${this.baseUrl}/user/register/begin`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const { options, user } = (await beginResponse.json()) as RegistrationBeginResponse\n\n // Step 2: Create credential using browser's WebAuthn API\n const credential: RegistrationResponseJSON = await startRegistration({\n optionsJSON: options\n })\n\n // Step 3: Send credential to server for verification\n const completeParams: RegistrationCompleteRequest = {\n projectId: this.projectId,\n userIdentifier: { userId: user.id },\n credential\n }\n\n const completeResponse = await fetch(`${this.baseUrl}/user/register/complete`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(completeParams)\n })\n\n if (!completeResponse.ok) {\n const errorData: ErrorResponse = await completeResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const response: RegistrationCompleteResponse = await completeResponse.json()\n if (!response) throw new Error(\"No registration response from server\")\n\n return response\n }\n\n /**\n * Add credential to existing user.\n * Requires a valid user authentication token passed in beginParams, which will be sent in the request body.\n * However, do not store the token in local storage, database, etc. Always keep it in memory.\n */\n async AddCredential(\n beginParams: UserCredentialBeginRequest\n ): Promise<UserCredentialCompleteResponse> {\n // Step 1: Get credential registration options from server\n\n const beginResponse = await fetch(`${this.baseUrl}/user/credential/begin`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const { options, user } = (await beginResponse.json()) as UserCredentialBeginResponse\n\n // Step 2: Create credential using browser's WebAuthn API\n const credential: RegistrationResponseJSON = await startRegistration({\n optionsJSON: options\n })\n\n // Step 3: Send credential to server for verification\n const completeParams: UserCredentialCompleteRequest = {\n userIdentifier: { userId: user.id },\n credential\n }\n\n const completeResponse = await fetch(`${this.baseUrl}/user/credential/complete`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(completeParams)\n })\n\n if (!completeResponse.ok) {\n const errorData: ErrorResponse = await completeResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const response: UserCredentialCompleteResponse = await completeResponse.json()\n if (!response) throw new Error(\"No credential registration response from server\")\n\n return response\n }\n\n /**\n * Performs a login ceremony.\n */\n async Login(beginParams: LoginBeginRequest): Promise<LoginCompleteResponse> {\n // Step 1: Get authentication options from server\n const beginResponse = await fetch(`${this.baseUrl}/login/begin`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const beginResponseData: LoginBeginResponse = await beginResponse.json()\n if (!beginResponseData.options) {\n throw new Error(\"No options found in login begin response\")\n }\n\n // Step 2: Pass options to the authenticator and wait for response\n const authenticationResponse: AuthenticationResponseJSON = await startAuthentication({\n optionsJSON: beginResponseData.options\n })\n\n if (!authenticationResponse) {\n throw new Error(\"No authentication response from browser\")\n }\n\n // Step 3: POST the response to the server\n // This uses the login session ID from the begin response - always in JS memory.\n // Do not store it in local storage, database, etc.\n const completeParams: LoginCompleteRequest = {\n projectId: this.projectId,\n loginSessionId: beginResponseData.loginSession.id,\n authenticationResponse\n }\n\n const verificationResponse = await fetch(`${this.baseUrl}/login/complete`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(completeParams)\n })\n\n if (!verificationResponse.ok) {\n const errorData: ErrorResponse = await verificationResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const verificationResponseData: LoginCompleteResponse = await verificationResponse.json()\n if (!verificationResponseData) throw new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gB,kBAAkB,aAAa;GAC/C;GACD;EAED,MAAM,uBAAuB,MAAM,MAAM,GAAG,KAAK,QAAQ,kBAAkB;GACzE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAC/C,MAAM,KAAK,UAAU,eAAe;GACrC,CAAC;AAEF,MAAI,CAAC,qBAAqB,IAAI;GAC5B,MAAMR,YAA2B,MAAM,qBAAqB,MAAM;AAClE,SAAM,IAAI,MAAM,UAAU,MAAM;;EAIlC,MAAMS,2BAAkD,MAAM,qBAAqB,MAAM;AACzF,MAAI,CAAC,yBAA0B,OAAM,IAAI,MAAM,6CAA6C;AAE5F,SAAO"}
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\"\nimport { RegistrationResponseJSON, AuthenticationResponseJSON } from \"@simplewebauthn/browser\"\n\nimport type {\n RegistrationBeginRequest,\n RegistrationCompleteRequest,\n UserCredentialBeginRequest,\n UserCredentialCompleteRequest,\n LoginBeginRequest,\n LoginCompleteRequest\n} from \"@plainkey/types\"\n\nimport type {\n RegistrationBeginResponse,\n RegistrationCompleteResponse,\n UserCredentialBeginResponse,\n UserCredentialCompleteResponse,\n LoginBeginResponse,\n LoginCompleteResponse,\n ErrorResponse\n} from \"@plainkey/types\"\n\nexport type PlainKeyClientParams = {\n projectId: string\n baseUrl?: string\n}\n\n// TODO: Account for errors like this: \"Unexpected token 'R', \"Response v\"... is not valid JSON\"\nexport class PlainKeyClient {\n private readonly projectId: string\n private readonly baseUrl: string\n\n constructor(clientParams: PlainKeyClientParams) {\n const { projectId, baseUrl = \"https://api.plainkey.io/api\" } = clientParams\n\n this.projectId = projectId\n this.baseUrl = baseUrl.replace(/\\/$/, \"\") // Remove trailing slash\n }\n\n /**\n * Registration of a new user with passkey.\n * Creates a new user and adds a credential to it.\n */\n async Registration(beginParams: RegistrationBeginRequest): Promise<RegistrationCompleteResponse> {\n // Step 1: Get registration options from server\n const beginResponse = await fetch(`${this.baseUrl}/user/register/begin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const { options, user } = (await beginResponse.json()) as RegistrationBeginResponse\n\n // Step 2: Create credential using browser's WebAuthn API\n const credential: RegistrationResponseJSON = await startRegistration({\n optionsJSON: options\n })\n\n // Step 3: Send credential to server for verification\n const completeParams: RegistrationCompleteRequest = {\n userIdentifier: { userId: user.id },\n credential\n }\n\n const completeResponse = await fetch(`${this.baseUrl}/user/register/complete`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(completeParams)\n })\n\n if (!completeResponse.ok) {\n const errorData: ErrorResponse = await completeResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const response: RegistrationCompleteResponse = await completeResponse.json()\n if (!response) throw new Error(\"No registration response from server\")\n\n return response\n }\n\n /**\n * Add credential to existing user.\n * Requires a valid user authentication token passed in beginParams, which will be sent in the request body.\n * However, do not store the token in local storage, database, etc. Always keep it in memory.\n */\n async AddCredential(\n beginParams: UserCredentialBeginRequest\n ): Promise<UserCredentialCompleteResponse> {\n // Step 1: Get credential registration options from server\n\n const beginResponse = await fetch(`${this.baseUrl}/user/credential/begin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const { options, user } = (await beginResponse.json()) as UserCredentialBeginResponse\n\n // Step 2: Create credential using browser's WebAuthn API\n const credential: RegistrationResponseJSON = await startRegistration({\n optionsJSON: options\n })\n\n // Step 3: Send credential to server for verification\n const completeParams: UserCredentialCompleteRequest = {\n userIdentifier: { userId: user.id },\n credential\n }\n\n const completeResponse = await fetch(`${this.baseUrl}/user/credential/complete`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(completeParams)\n })\n\n if (!completeResponse.ok) {\n const errorData: ErrorResponse = await completeResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const response: UserCredentialCompleteResponse = await completeResponse.json()\n if (!response) throw new Error(\"No credential registration response from server\")\n\n return response\n }\n\n /**\n * Performs a login ceremony.\n */\n async Login(beginParams: LoginBeginRequest): Promise<LoginCompleteResponse> {\n // Step 1: Get authentication options from server\n const beginResponse = await fetch(`${this.baseUrl}/login/begin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(beginParams)\n })\n\n if (!beginResponse.ok) {\n const errorData: ErrorResponse = await beginResponse.json()\n throw new Error(errorData.error)\n }\n\n const beginResponseData: LoginBeginResponse = await beginResponse.json()\n if (!beginResponseData.options) {\n throw new Error(\"No options found in login begin response\")\n }\n\n // Step 2: Pass options to the authenticator and wait for response\n const authenticationResponse: AuthenticationResponseJSON = await startAuthentication({\n optionsJSON: beginResponseData.options\n })\n\n if (!authenticationResponse) {\n throw new Error(\"No authentication response from browser\")\n }\n\n // Step 3: POST the response to the server\n // This uses the login session ID from the begin response - always in JS memory.\n // Do not store it in local storage, database, etc.\n const completeParams: LoginCompleteRequest = {\n loginSessionId: beginResponseData.loginSession.id,\n authenticationResponse\n }\n\n const verificationResponse = await fetch(`${this.baseUrl}/login/complete`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-project-id\": this.projectId\n },\n body: JSON.stringify(completeParams)\n })\n\n if (!verificationResponse.ok) {\n const errorData: ErrorResponse = await verificationResponse.json()\n throw new Error(errorData.error)\n }\n\n // Intentionally not throwing errors on verification failure - UI should handle this.\n const verificationResponseData: LoginCompleteResponse = await verificationResponse.json()\n if (!verificationResponseData) throw new Error(\"No login verification response from server\")\n\n return verificationResponseData\n }\n}\n"],"mappings":";;;AA4BA,IAAa,iBAAb,MAA4B;CAI1B,YAAY,cAAoC;EAC9C,MAAM,EAAE,WAAW,UAAU,kCAAkC;AAE/D,OAAK,YAAY;AACjB,OAAK,UAAU,QAAQ,QAAQ,OAAO,GAAG;;;;;;CAO3C,MAAM,aAAa,aAA8E;EAE/F,MAAM,gBAAgB,MAAM,MAAM,GAAG,KAAK,QAAQ,uBAAuB;GACvE,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,gBAAgB,KAAK;IACtB;GACD,MAAM,KAAK,UAAU,YAAY;GAClC,CAAC;AAEF,MAAI,CAAC,cAAc,IAAI;GACrB,MAAMA,YAA2B,MAAM,cAAc,MAAM;AAC3D,SAAM,IAAI,MAAM,UAAU,MAAM;;EAGlC,MAAM,EAAE,SAAS,SAAU,MAAM,cAAc,MAAM;EAGrD,MAAMC,aAAuC,MAAM,kBAAkB,EACnE,aAAa,SACd,CAAC;EAGF,MAAMC,iBAA8C;GAClD,gBAAgB,EAAE,QAAQ,KAAK,IAAI;GACnC;GACD;EAED,MAAM,mBAAmB,MAAM,MAAM,GAAG,KAAK,QAAQ,0BAA0B;GAC7E,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,gBAAgB,KAAK;IACtB;GACD,MAAM,KAAK,UAAU,eAAe;GACrC,CAAC;AAEF,MAAI,CAAC,iBAAiB,IAAI;GACxB,MAAMF,YAA2B,MAAM,iBAAiB,MAAM;AAC9D,SAAM,IAAI,MAAM,UAAU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AM,cAAc,MAAM;AAC3D,SAAM,IAAI,MAAM,UAAU,MAAM;;EAGlC,MAAMM,oBAAwC,MAAM,cAAc,MAAM;AACxE,MAAI,CAAC,kBAAkB,QACrB,OAAM,IAAI,MAAM,2CAA2C;EAI7D,MAAMC,yBAAqD,MAAM,oBAAoB,EACnF,aAAa,kBAAkB,SAChC,CAAC;AAEF,MAAI,CAAC,uBACH,OAAM,IAAI,MAAM,0CAA0C;EAM5D,MAAMC,iBAAuC;GAC3C,gBAAgB,kBAAkB,aAAa;GAC/C;GACD;EAED,MAAM,uBAAuB,MAAM,MAAM,GAAG,KAAK,QAAQ,kBAAkB;GACzE,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,gBAAgB,KAAK;IACtB;GACD,MAAM,KAAK,UAAU,eAAe;GACrC,CAAC;AAEF,MAAI,CAAC,qBAAqB,IAAI;GAC5B,MAAMR,YAA2B,MAAM,qBAAqB,MAAM;AAClE,SAAM,IAAI,MAAM,UAAU,MAAM;;EAIlC,MAAMS,2BAAkD,MAAM,qBAAqB,MAAM;AACzF,MAAI,CAAC,yBAA0B,OAAM,IAAI,MAAM,6CAA6C;AAE5F,SAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainkey/browser",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "PlainKey TypeScript browser SDK",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",