passkey-kit 0.10.13 → 0.10.15
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 +4 -4
- package/src/kit.ts +10 -4
- package/types/kit.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15",
|
|
4
4
|
"description": "A helper library for creating and using smart wallet accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"main": "src/index.ts",
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@simplewebauthn/browser": "^13.
|
|
11
|
+
"@simplewebauthn/browser": "^13.1.0",
|
|
12
12
|
"@stellar/stellar-sdk": "^13.1.0",
|
|
13
13
|
"base64url": "^3.0.1",
|
|
14
14
|
"buffer": "^6.0.3",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@simplewebauthn/types": "^12.0.0",
|
|
20
|
-
"@types/node": "^22.
|
|
21
|
-
"typescript": "^5.
|
|
20
|
+
"@types/node": "^22.13.6",
|
|
21
|
+
"typescript": "^5.8.2"
|
|
22
22
|
},
|
|
23
23
|
"workspaces": [
|
|
24
24
|
"packages/*"
|
package/src/kit.ts
CHANGED
|
@@ -39,7 +39,12 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
39
39
|
super(rpcUrl)
|
|
40
40
|
|
|
41
41
|
this.networkPassphrase = networkPassphrase
|
|
42
|
-
this
|
|
42
|
+
// this account exists as the seed source for deploying new wallets
|
|
43
|
+
// not using the genesis wallet as on mainnet the account has no usable signers
|
|
44
|
+
// there's a chance this isn't the best move and should instead be a constructor variable
|
|
45
|
+
// alternatively when we create a new wallet we shouldn't inherit the source as the auth entry signer
|
|
46
|
+
// Keypair.fromRawEd25519Seed(hash(Buffer.from(this.networkPassphrase)))
|
|
47
|
+
this.walletKeypair = Keypair.fromRawEd25519Seed(hash(Buffer.from('kalepail')));
|
|
43
48
|
this.walletPublicKey = this.walletKeypair.publicKey()
|
|
44
49
|
this.walletWasmHash = walletWasmHash
|
|
45
50
|
this.WebAuthn = WebAuthn || { startRegistration, startAuthentication }
|
|
@@ -130,9 +135,10 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
130
135
|
public async connectWallet(opts?: {
|
|
131
136
|
rpId?: string,
|
|
132
137
|
keyId?: string | Uint8Array,
|
|
133
|
-
getContractId?: (keyId: string) => Promise<string | undefined
|
|
138
|
+
getContractId?: (keyId: string) => Promise<string | undefined>,
|
|
139
|
+
walletPublicKey?: string // TEMP for backwards compatibility when we seeded wallets from a factory address
|
|
134
140
|
}) {
|
|
135
|
-
let { keyId, rpId, getContractId } = opts || {}
|
|
141
|
+
let { keyId, rpId, getContractId, walletPublicKey } = opts || {}
|
|
136
142
|
let keyIdBuffer: Buffer
|
|
137
143
|
|
|
138
144
|
if (!keyId) {
|
|
@@ -163,7 +169,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
163
169
|
networkId: hash(Buffer.from(this.networkPassphrase)),
|
|
164
170
|
contractIdPreimage: xdr.ContractIdPreimage.contractIdPreimageFromAddress(
|
|
165
171
|
new xdr.ContractIdPreimageFromAddress({
|
|
166
|
-
address: Address.fromString(this.walletPublicKey).toScAddress(),
|
|
172
|
+
address: Address.fromString(walletPublicKey || this.walletPublicKey).toScAddress(),
|
|
167
173
|
salt: hash(keyIdBuffer),
|
|
168
174
|
})
|
|
169
175
|
)
|
package/types/kit.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
44
44
|
rpId?: string;
|
|
45
45
|
keyId?: string | Uint8Array;
|
|
46
46
|
getContractId?: (keyId: string) => Promise<string | undefined>;
|
|
47
|
+
walletPublicKey?: string;
|
|
47
48
|
}): Promise<{
|
|
48
49
|
keyId: Buffer<ArrayBufferLike>;
|
|
49
50
|
keyIdBase64: string;
|