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 +1 -1
- package/src/index.ts +24 -8
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -135,12 +135,28 @@ export class PasskeyAccount {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
public async connectWallet() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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.
|
|
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);
|