passkey-kit 0.5.5 → 0.5.6
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 +3 -3
- package/src/kit.ts +7 -2
- package/types/kit.d.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "A helper library for creating and using passkey accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"@stellar/stellar-sdk": "12.1.0",
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
|
+
"passkey-kit-sdk": "0.2.1",
|
|
16
17
|
"sac-sdk": "0.1.0",
|
|
17
|
-
"passkey-factory-sdk": "0.2.1"
|
|
18
|
-
"passkey-kit-sdk": "0.2.1"
|
|
18
|
+
"passkey-factory-sdk": "0.2.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@simplewebauthn/types": "^10.0.0",
|
package/src/kit.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Client as FactoryClient } from 'passkey-factory-sdk'
|
|
|
3
3
|
import { Address, StrKey, hash, xdr, Transaction, SorobanRpc, Operation, TransactionBuilder } from '@stellar/stellar-sdk'
|
|
4
4
|
import base64url from 'base64url'
|
|
5
5
|
import { startRegistration, startAuthentication } from "@simplewebauthn/browser"
|
|
6
|
-
import type { AuthenticatorAttestationResponseJSON } from "@simplewebauthn/types"
|
|
6
|
+
import type { AuthenticatorAttestationResponseJSON, AuthenticatorSelectionCriteria } from "@simplewebauthn/types"
|
|
7
7
|
import { Buffer } from 'buffer'
|
|
8
8
|
import { PasskeyBase } from './base'
|
|
9
9
|
import { DEFAULT_TIMEOUT } from '@stellar/stellar-sdk/contract'
|
|
@@ -66,9 +66,13 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
public async createKey(app: string, user: string,
|
|
69
|
+
public async createKey(app: string, user: string, settings?: {
|
|
70
|
+
rpId?: string
|
|
71
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria
|
|
72
|
+
}) {
|
|
70
73
|
const now = new Date()
|
|
71
74
|
const displayName = `${user} — ${now.toLocaleString()}`
|
|
75
|
+
const { rpId, authenticatorSelection } = settings || {}
|
|
72
76
|
const { id, response } = await this.WebAuthn.startRegistration({
|
|
73
77
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
74
78
|
rp: {
|
|
@@ -80,6 +84,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
80
84
|
name: displayName,
|
|
81
85
|
displayName
|
|
82
86
|
},
|
|
87
|
+
authenticatorSelection,
|
|
83
88
|
// authenticatorSelection: {
|
|
84
89
|
// requireResidentKey: false,
|
|
85
90
|
// residentKey: "preferred",
|
package/types/kit.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Client as PasskeyClient } from 'passkey-kit-sdk';
|
|
|
2
2
|
import { Client as FactoryClient } from 'passkey-factory-sdk';
|
|
3
3
|
import { xdr, Transaction, SorobanRpc } from '@stellar/stellar-sdk';
|
|
4
4
|
import { startRegistration, startAuthentication } from "@simplewebauthn/browser";
|
|
5
|
+
import type { AuthenticatorSelectionCriteria } from "@simplewebauthn/types";
|
|
5
6
|
import { Buffer } from 'buffer';
|
|
6
7
|
import { PasskeyBase } from './base';
|
|
7
8
|
export declare class PasskeyKit extends PasskeyBase {
|
|
@@ -29,7 +30,10 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
29
30
|
contractId: string;
|
|
30
31
|
xdr: string | undefined;
|
|
31
32
|
}>;
|
|
32
|
-
createKey(app: string, user: string,
|
|
33
|
+
createKey(app: string, user: string, settings?: {
|
|
34
|
+
rpId?: string;
|
|
35
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
36
|
+
}): Promise<{
|
|
33
37
|
keyId: Buffer;
|
|
34
38
|
publicKey: Buffer;
|
|
35
39
|
}>;
|