passkey-kit 0.12.0 → 0.12.1
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 +7 -6
- package/packages/passkey-kit-sdk/package.json +5 -2
- package/packages/passkey-kit-sdk/src/index.ts +2 -2
- package/packages/passkey-kit-sdk/types/index.d.ts +2 -2
- package/packages/sac-sdk/package.json +5 -2
- package/packages/sac-sdk/src/index.ts +2 -2
- package/packages/sac-sdk/types/index.d.ts +2 -2
- package/src/base.ts +1 -1
- package/src/kit.ts +145 -20
- package/src/sac.ts +1 -1
- package/src/server.ts +4 -4
- package/types/base.d.ts +1 -1
- package/types/kit.d.ts +18 -12
- package/types/sac.d.ts +1 -1
- package/types/server.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
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",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@openzeppelin/relayer-plugin-channels": "^0.5.0",
|
|
12
12
|
"@simplewebauthn/browser": "^13.2.0",
|
|
13
|
-
"@stellar/stellar-sdk": "
|
|
13
|
+
"@stellar/stellar-sdk": "16.0.0-rc.1",
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
|
-
"passkey-kit-sdk": "0.7.
|
|
17
|
-
"sac-sdk": "0.4.
|
|
16
|
+
"passkey-kit-sdk": "0.7.3",
|
|
17
|
+
"sac-sdk": "0.4.3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "^24.6.0",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"workspaces": [
|
|
24
24
|
"packages/*"
|
|
25
25
|
],
|
|
26
|
-
"
|
|
27
|
-
"node": ">=
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=22.18.0"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"build:demo": "cd demo && pnpm --ignore-workspace install && pnpm run build",
|
|
52
52
|
"deploy:demo": "npx wrangler pages deploy",
|
|
53
53
|
"deploy:demo:prod": "npx wrangler pages deploy --env production",
|
|
54
|
+
"test:p27-auth": "bun bun_tests/9.index.ts",
|
|
54
55
|
"build:sac": "pnpm --filter=sac-sdk run build",
|
|
55
56
|
"build:pks": "pnpm --filter=passkey-kit-sdk run build",
|
|
56
57
|
"build": "pnpm run build:sac && pnpm run build:pks && tsc",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.
|
|
2
|
+
"version": "0.7.3",
|
|
3
3
|
"name": "passkey-kit-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@stellar/stellar-sdk": "
|
|
12
|
+
"@stellar/stellar-sdk": "16.0.0-rc.1",
|
|
13
13
|
"buffer": "^6.0.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^5.9.2"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.0.0"
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
ClientOptions as ContractClientOptions,
|
|
6
6
|
MethodOptions,
|
|
7
7
|
Spec as ContractSpec,
|
|
8
|
-
} from '@stellar/stellar-sdk/
|
|
8
|
+
} from '@stellar/stellar-sdk/contract';
|
|
9
9
|
import type {
|
|
10
10
|
u32,
|
|
11
11
|
Option,
|
|
12
|
-
} from '@stellar/stellar-sdk/
|
|
12
|
+
} from '@stellar/stellar-sdk/contract';
|
|
13
13
|
|
|
14
14
|
if (typeof window !== 'undefined') {
|
|
15
15
|
//@ts-ignore Buffer exists
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
|
-
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/
|
|
3
|
-
import type { u32, Option } from '@stellar/stellar-sdk/
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/contract';
|
|
3
|
+
import type { u32, Option } from '@stellar/stellar-sdk/contract';
|
|
4
4
|
export declare const Errors: {
|
|
5
5
|
1: {
|
|
6
6
|
message: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.4.
|
|
2
|
+
"version": "0.4.3",
|
|
3
3
|
"name": "sac-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
"build": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@stellar/stellar-sdk": "
|
|
12
|
+
"@stellar/stellar-sdk": "16.0.0-rc.1",
|
|
13
13
|
"buffer": "^6.0.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^5.9.2"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.0.0"
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
ClientOptions as ContractClientOptions,
|
|
6
6
|
MethodOptions,
|
|
7
7
|
Spec as ContractSpec,
|
|
8
|
-
} from '@stellar/stellar-sdk/
|
|
8
|
+
} from '@stellar/stellar-sdk/contract';
|
|
9
9
|
import type {
|
|
10
10
|
u32,
|
|
11
11
|
i128,
|
|
12
|
-
} from '@stellar/stellar-sdk/
|
|
12
|
+
} from '@stellar/stellar-sdk/contract';
|
|
13
13
|
|
|
14
14
|
if (typeof window !== 'undefined') {
|
|
15
15
|
//@ts-ignore Buffer exists
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
|
-
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/
|
|
3
|
-
import type { u32, i128 } from '@stellar/stellar-sdk/
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/contract';
|
|
3
|
+
import type { u32, i128 } from '@stellar/stellar-sdk/contract';
|
|
4
4
|
export interface Client {
|
|
5
5
|
/**
|
|
6
6
|
* Construct and simulate a allowance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
package/src/base.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Server } from "@stellar/stellar-sdk/
|
|
1
|
+
import { Server } from "@stellar/stellar-sdk/rpc"
|
|
2
2
|
|
|
3
3
|
// TODO consider adding support for a signAuthEntry method that conforms to the ed25519 signature scheme of this passkey interface
|
|
4
4
|
// once we do that we can clean the code a little with the `xdr.HashIdPreimage.envelopeTypeSorobanAuthorization` stuff
|
package/src/kit.ts
CHANGED
|
@@ -1,12 +1,138 @@
|
|
|
1
1
|
import { Client as PasskeyClient, type Signature, type SignerKey as SDKSignerKey, type SignerLimits as SDKSignerLimits } from 'passkey-kit-sdk'
|
|
2
|
-
import
|
|
2
|
+
import * as StellarSdk from '@stellar/stellar-sdk'
|
|
3
|
+
import { StrKey, hash, xdr, Keypair, Address, TransactionBuilder, Operation } from '@stellar/stellar-sdk'
|
|
3
4
|
import { startRegistration, startAuthentication, type AuthenticationResponseJSON, type AuthenticatorAttestationResponseJSON, type AuthenticatorSelectionCriteria } from "@simplewebauthn/browser"
|
|
4
5
|
import { Buffer } from 'buffer'
|
|
5
6
|
import base64url from 'base64url'
|
|
6
7
|
import type { SignerKey, SignerLimits, SignerStore } from './types'
|
|
7
8
|
import { PasskeyBase } from './base'
|
|
8
|
-
import { AssembledTransaction, basicNodeSigner, type AssembledTransactionOptions, type Tx } from '@stellar/stellar-sdk/
|
|
9
|
-
import type { Server } from '@stellar/stellar-sdk/
|
|
9
|
+
import { AssembledTransaction, basicNodeSigner, type AssembledTransactionOptions, type Spec as ContractSpec, type Tx } from '@stellar/stellar-sdk/contract'
|
|
10
|
+
import type { Server } from '@stellar/stellar-sdk/rpc'
|
|
11
|
+
|
|
12
|
+
type P27HashIdPreimage = typeof xdr.HashIdPreimage & {
|
|
13
|
+
envelopeTypeSorobanAuthorizationWithAddress?: (value: unknown) => xdr.HashIdPreimage
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type P27Xdr = typeof xdr & {
|
|
17
|
+
HashIdPreimageSorobanAuthorizationWithAddress?: new (fields: {
|
|
18
|
+
networkId: Buffer
|
|
19
|
+
nonce: xdr.Int64
|
|
20
|
+
signatureExpirationLedger: number
|
|
21
|
+
invocation: xdr.SorobanAuthorizedInvocation
|
|
22
|
+
address: xdr.ScAddress
|
|
23
|
+
}) => unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type P27AuthSdk = typeof StellarSdk & {
|
|
27
|
+
buildAuthorizationEntryPreimage?: (
|
|
28
|
+
entry: xdr.SorobanAuthorizationEntry,
|
|
29
|
+
validUntilLedgerSeq: number,
|
|
30
|
+
networkPassphrase: string
|
|
31
|
+
) => xdr.HashIdPreimage
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type PasskeyClientWithSpec = PasskeyClient & {
|
|
35
|
+
spec: ContractSpec
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getAddressCredentials(credentials: xdr.SorobanCredentials): xdr.SorobanAddressCredentials {
|
|
39
|
+
const typedCredentials = credentials as unknown as {
|
|
40
|
+
address: () => xdr.SorobanAddressCredentials
|
|
41
|
+
addressV2?: () => xdr.SorobanAddressCredentials
|
|
42
|
+
addressWithDelegates?: () => {
|
|
43
|
+
addressCredentials: () => xdr.SorobanAddressCredentials
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
switch (credentials.switch().name as string) {
|
|
48
|
+
case 'sorobanCredentialsAddress':
|
|
49
|
+
return typedCredentials.address()
|
|
50
|
+
case 'sorobanCredentialsAddressV2':
|
|
51
|
+
if (!typedCredentials.addressV2) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'ADDRESS_V2 credentials require an SDK with Protocol 27 credential support'
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
return typedCredentials.addressV2()
|
|
57
|
+
case 'sorobanCredentialsAddressWithDelegates':
|
|
58
|
+
if (!typedCredentials.addressWithDelegates) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
'ADDRESS_WITH_DELEGATES credentials require an SDK with Protocol 27 credential support'
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
return typedCredentials.addressWithDelegates().addressCredentials()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
throw new Error(`Soroban credentials do not contain address credentials: ${credentials.switch().name}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function usesAddressBoundPayload(credentials: xdr.SorobanCredentials): boolean {
|
|
70
|
+
const credentialType = credentials.switch().name as string
|
|
71
|
+
return credentialType === 'sorobanCredentialsAddressV2'
|
|
72
|
+
|| credentialType === 'sorobanCredentialsAddressWithDelegates'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function assertSignatureExpirationLedger(expiration: number): void {
|
|
76
|
+
if (!Number.isInteger(expiration) || expiration < 0 || expiration > 0xffffffff) {
|
|
77
|
+
throw new Error('Soroban signature expiration ledger must be a uint32 integer')
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function buildSignaturePayload(
|
|
82
|
+
networkPassphrase: string,
|
|
83
|
+
entry: xdr.SorobanAuthorizationEntry,
|
|
84
|
+
expiration: number
|
|
85
|
+
): Buffer {
|
|
86
|
+
assertSignatureExpirationLedger(expiration)
|
|
87
|
+
|
|
88
|
+
const credentials = getAddressCredentials(entry.credentials())
|
|
89
|
+
const sdkAuth = StellarSdk as P27AuthSdk
|
|
90
|
+
|
|
91
|
+
if (sdkAuth.buildAuthorizationEntryPreimage) {
|
|
92
|
+
credentials.signatureExpirationLedger(expiration)
|
|
93
|
+
return hash(sdkAuth.buildAuthorizationEntryPreimage(
|
|
94
|
+
entry,
|
|
95
|
+
expiration,
|
|
96
|
+
networkPassphrase
|
|
97
|
+
).toXDR())
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (usesAddressBoundPayload(entry.credentials())) {
|
|
101
|
+
const hashIdPreimage = xdr.HashIdPreimage as P27HashIdPreimage
|
|
102
|
+
const WithAddressPreimage = (xdr as P27Xdr).HashIdPreimageSorobanAuthorizationWithAddress
|
|
103
|
+
|
|
104
|
+
if (!hashIdPreimage.envelopeTypeSorobanAuthorizationWithAddress || !WithAddressPreimage) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
'Address-bound Soroban auth credentials require an SDK with Protocol 27 auth preimage support'
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
credentials.signatureExpirationLedger(expiration)
|
|
111
|
+
const preimage = hashIdPreimage.envelopeTypeSorobanAuthorizationWithAddress(
|
|
112
|
+
new WithAddressPreimage({
|
|
113
|
+
networkId: hash(Buffer.from(networkPassphrase)),
|
|
114
|
+
nonce: credentials.nonce(),
|
|
115
|
+
signatureExpirationLedger: expiration,
|
|
116
|
+
invocation: entry.rootInvocation(),
|
|
117
|
+
address: credentials.address(),
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return hash(preimage.toXDR())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
credentials.signatureExpirationLedger(expiration)
|
|
125
|
+
const preimage = xdr.HashIdPreimage.envelopeTypeSorobanAuthorization(
|
|
126
|
+
new xdr.HashIdPreimageSorobanAuthorization({
|
|
127
|
+
networkId: hash(Buffer.from(networkPassphrase)),
|
|
128
|
+
nonce: credentials.nonce(),
|
|
129
|
+
signatureExpirationLedger: expiration,
|
|
130
|
+
invocation: entry.rootInvocation()
|
|
131
|
+
})
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
return hash(preimage.toXDR())
|
|
135
|
+
}
|
|
10
136
|
|
|
11
137
|
// TODO we should allow setting the rpId in the constructor so we don't have to keep setting it for every call
|
|
12
138
|
// e.g. if you want to sign with a smol.xyz key on next.smol.xyz key you have to set rpId over and over again
|
|
@@ -28,6 +154,10 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
28
154
|
public networkPassphrase: string
|
|
29
155
|
public wallet: PasskeyClient | undefined
|
|
30
156
|
|
|
157
|
+
private get walletSpec(): ContractSpec {
|
|
158
|
+
return (this.wallet as PasskeyClientWithSpec).spec
|
|
159
|
+
}
|
|
160
|
+
|
|
31
161
|
constructor(options: {
|
|
32
162
|
rpcUrl: string,
|
|
33
163
|
networkPassphrase: string,
|
|
@@ -247,7 +377,12 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
247
377
|
if ([keyId, keypair, policy].filter((arg) => !!arg).length > 1)
|
|
248
378
|
throw new Error('Exactly one of `options.keyId`, `options.keypair`, or `options.policy` must be provided.');
|
|
249
379
|
|
|
250
|
-
const
|
|
380
|
+
const credentialType = entry.credentials().switch().name as string
|
|
381
|
+
if (credentialType === 'sorobanCredentialsAddressWithDelegates') {
|
|
382
|
+
throw new Error('ADDRESS_WITH_DELEGATES auth entries are not supported by passkey signing yet')
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const credentials = getAddressCredentials(entry.credentials());
|
|
251
386
|
|
|
252
387
|
if (!expiration) {
|
|
253
388
|
expiration = credentials.signatureExpirationLedger()
|
|
@@ -255,21 +390,11 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
255
390
|
if (!expiration) {
|
|
256
391
|
const { sequence } = await this.rpc.getLatestLedger()
|
|
257
392
|
expiration = sequence + this.timeoutInSeconds / 5; // assumes 5 second ledger time
|
|
393
|
+
expiration = Math.ceil(expiration)
|
|
258
394
|
}
|
|
259
395
|
}
|
|
260
396
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const preimage = xdr.HashIdPreimage.envelopeTypeSorobanAuthorization(
|
|
264
|
-
new xdr.HashIdPreimageSorobanAuthorization({
|
|
265
|
-
networkId: hash(Buffer.from(this.networkPassphrase)),
|
|
266
|
-
nonce: credentials.nonce(),
|
|
267
|
-
signatureExpirationLedger: credentials.signatureExpirationLedger(),
|
|
268
|
-
invocation: entry.rootInvocation()
|
|
269
|
-
})
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
const payload = hash(preimage.toXDR())
|
|
397
|
+
const payload = buildSignaturePayload(this.networkPassphrase, entry, expiration)
|
|
273
398
|
|
|
274
399
|
// let signatures: Signatures
|
|
275
400
|
let key: SDKSignerKey
|
|
@@ -367,8 +492,8 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
367
492
|
const scValType = xdr.ScSpecTypeDef.scSpecTypeUdt(
|
|
368
493
|
new xdr.ScSpecTypeUdt({ name: "Signature" }),
|
|
369
494
|
);
|
|
370
|
-
const scKey = this.
|
|
371
|
-
const scVal = val ? this.
|
|
495
|
+
const scKey = this.walletSpec.nativeToScVal(key, scKeyType);
|
|
496
|
+
const scVal = val ? this.walletSpec.nativeToScVal(val, scValType) : xdr.ScVal.scvVoid();
|
|
372
497
|
const scEntry = new xdr.ScMapEntry({
|
|
373
498
|
key: scKey,
|
|
374
499
|
val: scVal,
|
|
@@ -434,7 +559,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
434
559
|
) {
|
|
435
560
|
if (!(txn instanceof AssembledTransaction)) {
|
|
436
561
|
try {
|
|
437
|
-
txn = AssembledTransaction.fromXDR(this.wallet!.options, typeof txn === 'string' ? txn : txn.toXDR(), this.
|
|
562
|
+
txn = AssembledTransaction.fromXDR(this.wallet!.options, typeof txn === 'string' ? txn : txn.toXDR(), this.walletSpec);
|
|
438
563
|
} catch {
|
|
439
564
|
if (!(txn instanceof AssembledTransaction)) {
|
|
440
565
|
const built = TransactionBuilder.fromXDR(typeof txn === 'string' ? txn : txn.toXDR(), this.networkPassphrase);
|
|
@@ -695,4 +820,4 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
695
820
|
|
|
696
821
|
return concatSignature;
|
|
697
822
|
}
|
|
698
|
-
}
|
|
823
|
+
}
|
package/src/sac.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client as SacClient } from 'sac-sdk'
|
|
2
2
|
import { PasskeyBase } from "./base"
|
|
3
|
-
import type { Server } from '@stellar/stellar-sdk/
|
|
3
|
+
import type { Server } from '@stellar/stellar-sdk/rpc'
|
|
4
4
|
|
|
5
5
|
export class SACClient extends PasskeyBase {
|
|
6
6
|
declare rpc: Server
|
package/src/server.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { xdr } from "@stellar/stellar-sdk
|
|
1
|
+
import { xdr } from "@stellar/stellar-sdk"
|
|
2
2
|
import { PasskeyBase } from "./base"
|
|
3
3
|
import base64url from "base64url"
|
|
4
|
-
import type { Tx } from "@stellar/stellar-sdk/
|
|
4
|
+
import type { Tx } from "@stellar/stellar-sdk/contract"
|
|
5
5
|
import type { Signer } from "./types"
|
|
6
|
-
import { AssembledTransaction } from "@stellar/stellar-sdk/
|
|
7
|
-
import { Durability } from "@stellar/stellar-sdk/
|
|
6
|
+
import { AssembledTransaction } from "@stellar/stellar-sdk/contract"
|
|
7
|
+
import { Durability } from "@stellar/stellar-sdk/rpc"
|
|
8
8
|
import { ChannelsClient } from "@openzeppelin/relayer-plugin-channels"
|
|
9
9
|
|
|
10
10
|
export class PasskeyServer extends PasskeyBase {
|
package/types/base.d.ts
CHANGED
package/types/kit.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Client as PasskeyClient } from 'passkey-kit-sdk';
|
|
2
|
-
import
|
|
2
|
+
import * as StellarSdk from '@stellar/stellar-sdk';
|
|
3
|
+
import { xdr, Keypair } from '@stellar/stellar-sdk';
|
|
3
4
|
import { startRegistration, startAuthentication, type AuthenticationResponseJSON, type AuthenticatorSelectionCriteria } from "@simplewebauthn/browser";
|
|
4
5
|
import { Buffer } from 'buffer';
|
|
5
6
|
import type { SignerKey, SignerLimits, SignerStore } from './types';
|
|
6
7
|
import { PasskeyBase } from './base';
|
|
7
|
-
import { AssembledTransaction, type Tx } from '@stellar/stellar-sdk/
|
|
8
|
-
import type { Server } from '@stellar/stellar-sdk/
|
|
8
|
+
import { AssembledTransaction, type Tx } from '@stellar/stellar-sdk/contract';
|
|
9
|
+
import type { Server } from '@stellar/stellar-sdk/rpc';
|
|
10
|
+
export declare function getAddressCredentials(credentials: xdr.SorobanCredentials): xdr.SorobanAddressCredentials;
|
|
11
|
+
export declare function usesAddressBoundPayload(credentials: xdr.SorobanCredentials): boolean;
|
|
12
|
+
export declare function assertSignatureExpirationLedger(expiration: number): void;
|
|
13
|
+
export declare function buildSignaturePayload(networkPassphrase: string, entry: xdr.SorobanAuthorizationEntry, expiration: number): Buffer;
|
|
9
14
|
export declare class PasskeyKit extends PasskeyBase {
|
|
10
15
|
rpc: Server;
|
|
11
16
|
rpcUrl: string;
|
|
@@ -17,6 +22,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
17
22
|
keyId: string | undefined;
|
|
18
23
|
networkPassphrase: string;
|
|
19
24
|
wallet: PasskeyClient | undefined;
|
|
25
|
+
private get walletSpec();
|
|
20
26
|
constructor(options: {
|
|
21
27
|
rpcUrl: string;
|
|
22
28
|
networkPassphrase: string;
|
|
@@ -35,7 +41,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
35
41
|
keyId: Buffer<ArrayBufferLike>;
|
|
36
42
|
keyIdBase64: string;
|
|
37
43
|
contractId: string;
|
|
38
|
-
signedTx:
|
|
44
|
+
signedTx: StellarSdk.Transaction;
|
|
39
45
|
}>;
|
|
40
46
|
createKey(app: string, user: string, settings?: {
|
|
41
47
|
rpId?: string;
|
|
@@ -70,14 +76,14 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
70
76
|
keypair?: Keypair;
|
|
71
77
|
policy?: string;
|
|
72
78
|
expiration?: number;
|
|
73
|
-
}): Promise<AssembledTransaction<T>>;
|
|
74
|
-
addSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
75
|
-
addEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
76
|
-
addPolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
77
|
-
updateSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
78
|
-
updateEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
79
|
-
updatePolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<AssembledTransaction<null>>;
|
|
80
|
-
remove(signer: SignerKey): Promise<AssembledTransaction<null>>;
|
|
79
|
+
}): Promise<StellarSdk.contract.AssembledTransaction<T>>;
|
|
80
|
+
addSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
81
|
+
addEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
82
|
+
addPolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
83
|
+
updateSecp256r1(keyId: string | Uint8Array, publicKey: string | Uint8Array, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
84
|
+
updateEd25519(publicKey: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
85
|
+
updatePolicy(policy: string, limits: SignerLimits, store: SignerStore, expiration?: number): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
86
|
+
remove(signer: SignerKey): Promise<StellarSdk.contract.AssembledTransaction<null>>;
|
|
81
87
|
private secp256r1;
|
|
82
88
|
private ed25519;
|
|
83
89
|
private policy;
|
package/types/sac.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client as SacClient } from 'sac-sdk';
|
|
2
2
|
import { PasskeyBase } from "./base";
|
|
3
|
-
import type { Server } from '@stellar/stellar-sdk/
|
|
3
|
+
import type { Server } from '@stellar/stellar-sdk/rpc';
|
|
4
4
|
export declare class SACClient extends PasskeyBase {
|
|
5
5
|
rpc: Server;
|
|
6
6
|
rpcUrl: string;
|
package/types/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PasskeyBase } from "./base";
|
|
2
|
-
import type { Tx } from "@stellar/stellar-sdk/
|
|
2
|
+
import type { Tx } from "@stellar/stellar-sdk/contract";
|
|
3
3
|
import type { Signer } from "./types";
|
|
4
|
-
import { AssembledTransaction } from "@stellar/stellar-sdk/
|
|
4
|
+
import { AssembledTransaction } from "@stellar/stellar-sdk/contract";
|
|
5
5
|
export declare class PasskeyServer extends PasskeyBase {
|
|
6
6
|
private relayerApiKey;
|
|
7
7
|
private mercuryJwt;
|