passkey-kit 0.0.27 → 0.0.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "types/index.d.ts",
package/src/index.ts CHANGED
@@ -135,12 +135,28 @@ export class PasskeyAccount {
135
135
  }
136
136
  }
137
137
 
138
- public async connectWallet() {
139
- const startAuthenticationResponse = await startAuthentication({
140
- challenge: base64url("sorobanisbest"),
141
- // rpId: undefined,
142
- userVerification: "discouraged",
143
- });
138
+ public async connectWallet(id?: string) {
139
+ /* TODO
140
+ - Support passing in a contractId as well as a keyId
141
+ Maybe not as we wouldn't have a keyId which could have interesting consequences
142
+ Also not sure what the use case would be for this where keyId wouldn't also be possible and better
143
+ */
144
+
145
+ // @ts-ignore
146
+ // https://github.com/stellar/js-stellar-base/issues/750
147
+ // if (id && StrKey.isValidContract(id)) {
148
+
149
+ // } else {
150
+
151
+ // }
152
+
153
+ const startAuthenticationResponse = id
154
+ ? { id }
155
+ : await startAuthentication({
156
+ challenge: base64url("sorobanisbest"),
157
+ // rpId: undefined,
158
+ userVerification: "discouraged",
159
+ });
144
160
 
145
161
  if (!this.keyId)
146
162
  this.keyId = startAuthenticationResponse.id
@@ -220,7 +236,7 @@ export class PasskeyAccount {
220
236
  )
221
237
 
222
238
  const authenticationResponse = await startAuthentication(
223
- keyId === 'any' || (keyId === 'sudo' && !this.sudoKeyId)
239
+ keyId === 'any' || (keyId === 'sudo' && !this.sudoKeyId) || (!keyId && !this.keyId)
224
240
  ? {
225
241
  challenge: base64url(authHash),
226
242
  // rpId: undefined,
@@ -247,7 +263,7 @@ export class PasskeyAccount {
247
263
  if (keyId === 'sudo')
248
264
  this.sudoKeyId = authenticationResponse.id
249
265
 
250
- // reset this.id to be the most recently used passkey
266
+ // reset this.keyId to be the most recently used passkey
251
267
  this.keyId = authenticationResponse.id
252
268
 
253
269
  const signatureRaw = base64url.toBuffer(authenticationResponse.response.signature);
package/types/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare class PasskeyAccount {
34
34
  keyId: Buffer;
35
35
  publicKey: Buffer;
36
36
  }>;
37
- connectWallet(): Promise<{
37
+ connectWallet(id?: string): Promise<{
38
38
  keyId: Buffer;
39
39
  contractId: string;
40
40
  }>;