@soropass/core 0.1.2 → 0.2.0
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/dist/{checkAuth-C2AcXqFe.d.cts → checkAuth-B5ObsEsP.d.cts} +11 -7
- package/dist/{checkAuth-C2AcXqFe.d.ts → checkAuth-B5ObsEsP.d.ts} +11 -7
- package/dist/{chunk-AHFGTIBY.js → chunk-2KLSTE4E.js} +16 -4
- package/dist/chunk-2KLSTE4E.js.map +1 -0
- package/dist/{chunk-KDBIRRF7.js → chunk-42ETVY6V.js} +3 -3
- package/dist/{chunk-KDBIRRF7.js.map → chunk-42ETVY6V.js.map} +1 -1
- package/dist/{chunk-ZQRFIL4P.js → chunk-ODXQCLZL.js} +18 -6
- package/dist/chunk-ODXQCLZL.js.map +1 -0
- package/dist/{chunk-MMB4ZIW3.js → chunk-OHKPNVB3.js} +13 -5
- package/dist/chunk-OHKPNVB3.js.map +1 -0
- package/dist/{chunk-BLFCRWCT.js → chunk-QREICNIW.js} +3 -3
- package/dist/{chunk-BLFCRWCT.js.map → chunk-QREICNIW.js.map} +1 -1
- package/dist/{chunk-W75OQKHR.js → chunk-RFMHMWTY.js} +5 -3
- package/dist/chunk-RFMHMWTY.js.map +1 -0
- package/dist/{chunk-FIRTUNWF.js → chunk-XTLWH3VQ.js} +26 -5
- package/dist/chunk-XTLWH3VQ.js.map +1 -0
- package/dist/connect.cjs +14 -2
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +11 -1
- package/dist/connect.d.ts +11 -1
- package/dist/connect.js +1 -1
- package/dist/create.cjs +14 -4
- package/dist/create.cjs.map +1 -1
- package/dist/create.d.cts +20 -12
- package/dist/create.d.ts +20 -12
- package/dist/create.js +2 -2
- package/dist/index.cjs +77 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/dist/{recover-0wbOXDjR.d.cts → recover-BOq0DQaU.d.cts} +1 -1
- package/dist/{recover-COnsxhYk.d.ts → recover-CL_jZ2kN.d.ts} +1 -1
- package/dist/recover.cjs +24 -3
- package/dist/recover.cjs.map +1 -1
- package/dist/recover.d.cts +4 -4
- package/dist/recover.d.ts +4 -4
- package/dist/recover.js +3 -3
- package/dist/{sign-B4JV2Inn.d.ts → sign-O5d7Moma.d.cts} +15 -0
- package/dist/{sign-B4JV2Inn.d.cts → sign-O5d7Moma.d.ts} +15 -0
- package/dist/sign.cjs +39 -6
- package/dist/sign.cjs.map +1 -1
- package/dist/sign.d.cts +27 -14
- package/dist/sign.d.ts +27 -14
- package/dist/sign.js +3 -3
- package/dist/{submit-BsKXOCkL.d.cts → submit-BKogb6Y8.d.cts} +2 -2
- package/dist/{submit-CZt8fNRf.d.ts → submit-CKJp7XgZ.d.ts} +2 -2
- package/dist/testing.cjs +46 -8
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +8 -5
- package/dist/testing.js.map +1 -1
- package/dist/{types-C3VIw5Iu.d.ts → types-BJsL-q2B.d.ts} +3 -3
- package/dist/{types-DLcXrud8.d.cts → types-B_pVAg-T.d.cts} +3 -3
- package/dist/{types--WNl-Sda.d.cts → types-CJluKV7s.d.cts} +8 -0
- package/dist/{types--WNl-Sda.d.ts → types-CJluKV7s.d.ts} +8 -0
- package/dist/types.d.cts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/chunk-AHFGTIBY.js.map +0 -1
- package/dist/chunk-FIRTUNWF.js.map +0 -1
- package/dist/chunk-MMB4ZIW3.js.map +0 -1
- package/dist/chunk-W75OQKHR.js.map +0 -1
- package/dist/chunk-ZQRFIL4P.js.map +0 -1
package/dist/sign.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { S as SmartWalletCheckAuthResult, d as decodeChallenge, e as encodeChallenge, p as parseAuthenticatorData, b as parseClientDataJSON, r as referenceCheckAuth, c as referenceSmartWalletCheckAuth, v as verifyAssertionSignature, f as verifyClientDataJSON, g as verifyRpIdHash } from './checkAuth-
|
|
2
|
-
import { b as WebAuthnSigner, A as AssertionResult } from './sign-
|
|
3
|
-
export { S as SignVerifyOptions, a as SorobanSignOptions, W as WalletTarget, s as signAuthEntry, c as signTransaction } from './sign-
|
|
4
|
-
import { W as WebAuthnClient } from './types
|
|
1
|
+
export { S as SmartWalletCheckAuthResult, d as decodeChallenge, e as encodeChallenge, p as parseAuthenticatorData, b as parseClientDataJSON, r as referenceCheckAuth, c as referenceSmartWalletCheckAuth, v as verifyAssertionSignature, f as verifyClientDataJSON, g as verifyRpIdHash } from './checkAuth-B5ObsEsP.cjs';
|
|
2
|
+
import { b as WebAuthnSigner, A as AssertionResult } from './sign-O5d7Moma.cjs';
|
|
3
|
+
export { S as SignVerifyOptions, a as SorobanSignOptions, W as WalletTarget, s as signAuthEntry, c as signTransaction } from './sign-O5d7Moma.cjs';
|
|
4
|
+
import { W as WebAuthnClient } from './types-CJluKV7s.cjs';
|
|
5
5
|
import { xdr } from '@stellar/stellar-sdk';
|
|
6
|
-
export { B as BuildAddSignerOptions, a as BuildRemoveSignerOptions, S as Secp256r1SignerSpec, b as SendSmartWalletTxOptions, c as SignerStorage, d as buildAddSignerOperation, e as buildRemoveSignerOperation, f as buildSecp256r1Signer, s as sendSmartWalletTx } from './submit-
|
|
6
|
+
export { B as BuildAddSignerOptions, a as BuildRemoveSignerOptions, S as Secp256r1SignerSpec, b as SendSmartWalletTxOptions, c as SignerStorage, d as buildAddSignerOperation, e as buildRemoveSignerOperation, f as buildSecp256r1Signer, s as sendSmartWalletTx } from './submit-BKogb6Y8.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Convert an ASN.1 DER ECDSA signature to the 64-byte raw `R‖S` form Soroban's
|
|
@@ -19,9 +19,10 @@ declare function isLowS(compactSignature: Uint8Array): boolean;
|
|
|
19
19
|
/**
|
|
20
20
|
* Normalize a 64-byte compact signature to canonical low-S: if S > n/2, replace
|
|
21
21
|
* S with n − S (anchor LOW_S_NORMALIZATION, invariant #2). ~50% of Apple Touch
|
|
22
|
-
* ID / Face ID assertions are high-S and Soroban's `secp256r1_verify`
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* ID / Face ID assertions are high-S, and Soroban's `secp256r1_verify` REJECTS a
|
|
23
|
+
* high-S signature at decode, so the SDK MUST emit low-S or roughly half of real
|
|
24
|
+
* assertions would fail on-chain. Low-S is a validity requirement here, not just
|
|
25
|
+
* malleability hygiene. Idempotent: low-S input is returned unchanged.
|
|
25
26
|
*/
|
|
26
27
|
declare function normalizeLowS(compactSignature: Uint8Array): Uint8Array;
|
|
27
28
|
/** DER → 64-byte canonical low-S compact — the conversion the signing ceremony uses. */
|
|
@@ -50,6 +51,13 @@ interface BrowserPasskeySignerOptions {
|
|
|
50
51
|
userVerification?: 'discouraged' | 'preferred' | 'required';
|
|
51
52
|
/** Inject a custom client (tests / non-browser). Defaults to `browserWebAuthnClient()`. */
|
|
52
53
|
webauthn?: WebAuthnClient;
|
|
54
|
+
/**
|
|
55
|
+
* SEC-1 (65-byte) public key of this passkey (from `create` / `connect`).
|
|
56
|
+
* WebAuthn assertions do not return the public key, so pass it here to sign
|
|
57
|
+
* for the v0.2 single-signer account; it is echoed onto the `AssertionResult`.
|
|
58
|
+
* You can instead supply it once via `SorobanSignOptions.publicKey`.
|
|
59
|
+
*/
|
|
60
|
+
publicKey?: Uint8Array;
|
|
53
61
|
}
|
|
54
62
|
/**
|
|
55
63
|
* Adapt `navigator.credentials.get` into the `WebAuthnSigner` that
|
|
@@ -80,17 +88,22 @@ declare function authEntryChallenge(entry: xdr.SorobanAuthorizationEntry, networ
|
|
|
80
88
|
|
|
81
89
|
/**
|
|
82
90
|
* Set an address-credential auth entry's signature to the `Secp256r1Signature`
|
|
83
|
-
* struct
|
|
91
|
+
* struct our v0.2 `webauthn-account` `__check_auth` consumes:
|
|
84
92
|
*
|
|
85
|
-
* ScVal::Map {
|
|
93
|
+
* ScVal::Map {
|
|
94
|
+
* authenticator_data: Bytes,
|
|
95
|
+
* client_data_json: Bytes,
|
|
96
|
+
* public_key: BytesN<65>, // the enrolled signer to verify against
|
|
97
|
+
* signature: BytesN<64>,
|
|
98
|
+
* }
|
|
86
99
|
*
|
|
87
100
|
* Map keys are alphabetical, so the ScMap is canonically sorted as Soroban
|
|
88
101
|
* requires. `signature` MUST already be 64-byte low-S compact (`signAuthEntry`
|
|
89
|
-
* normalizes before calling this).
|
|
90
|
-
*
|
|
91
|
-
*
|
|
102
|
+
* normalizes before calling this). `publicKey` names which enrolled signer the
|
|
103
|
+
* contract checks; the multi-signer account rejects a key it does not hold
|
|
104
|
+
* before any crypto runs.
|
|
92
105
|
*/
|
|
93
|
-
declare function applyAssertionToEntry(entry: xdr.SorobanAuthorizationEntry, assertion: AssertionResult): xdr.SorobanAuthorizationEntry;
|
|
106
|
+
declare function applyAssertionToEntry(entry: xdr.SorobanAuthorizationEntry, assertion: AssertionResult, publicKey: Uint8Array): xdr.SorobanAuthorizationEntry;
|
|
94
107
|
|
|
95
108
|
/**
|
|
96
109
|
* The passkey-kit / `webauthn-wallet` smart-wallet ABI target.
|
package/dist/sign.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { S as SmartWalletCheckAuthResult, d as decodeChallenge, e as encodeChallenge, p as parseAuthenticatorData, b as parseClientDataJSON, r as referenceCheckAuth, c as referenceSmartWalletCheckAuth, v as verifyAssertionSignature, f as verifyClientDataJSON, g as verifyRpIdHash } from './checkAuth-
|
|
2
|
-
import { b as WebAuthnSigner, A as AssertionResult } from './sign-
|
|
3
|
-
export { S as SignVerifyOptions, a as SorobanSignOptions, W as WalletTarget, s as signAuthEntry, c as signTransaction } from './sign-
|
|
4
|
-
import { W as WebAuthnClient } from './types
|
|
1
|
+
export { S as SmartWalletCheckAuthResult, d as decodeChallenge, e as encodeChallenge, p as parseAuthenticatorData, b as parseClientDataJSON, r as referenceCheckAuth, c as referenceSmartWalletCheckAuth, v as verifyAssertionSignature, f as verifyClientDataJSON, g as verifyRpIdHash } from './checkAuth-B5ObsEsP.js';
|
|
2
|
+
import { b as WebAuthnSigner, A as AssertionResult } from './sign-O5d7Moma.js';
|
|
3
|
+
export { S as SignVerifyOptions, a as SorobanSignOptions, W as WalletTarget, s as signAuthEntry, c as signTransaction } from './sign-O5d7Moma.js';
|
|
4
|
+
import { W as WebAuthnClient } from './types-CJluKV7s.js';
|
|
5
5
|
import { xdr } from '@stellar/stellar-sdk';
|
|
6
|
-
export { B as BuildAddSignerOptions, a as BuildRemoveSignerOptions, S as Secp256r1SignerSpec, b as SendSmartWalletTxOptions, c as SignerStorage, d as buildAddSignerOperation, e as buildRemoveSignerOperation, f as buildSecp256r1Signer, s as sendSmartWalletTx } from './submit-
|
|
6
|
+
export { B as BuildAddSignerOptions, a as BuildRemoveSignerOptions, S as Secp256r1SignerSpec, b as SendSmartWalletTxOptions, c as SignerStorage, d as buildAddSignerOperation, e as buildRemoveSignerOperation, f as buildSecp256r1Signer, s as sendSmartWalletTx } from './submit-CKJp7XgZ.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Convert an ASN.1 DER ECDSA signature to the 64-byte raw `R‖S` form Soroban's
|
|
@@ -19,9 +19,10 @@ declare function isLowS(compactSignature: Uint8Array): boolean;
|
|
|
19
19
|
/**
|
|
20
20
|
* Normalize a 64-byte compact signature to canonical low-S: if S > n/2, replace
|
|
21
21
|
* S with n − S (anchor LOW_S_NORMALIZATION, invariant #2). ~50% of Apple Touch
|
|
22
|
-
* ID / Face ID assertions are high-S and Soroban's `secp256r1_verify`
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* ID / Face ID assertions are high-S, and Soroban's `secp256r1_verify` REJECTS a
|
|
23
|
+
* high-S signature at decode, so the SDK MUST emit low-S or roughly half of real
|
|
24
|
+
* assertions would fail on-chain. Low-S is a validity requirement here, not just
|
|
25
|
+
* malleability hygiene. Idempotent: low-S input is returned unchanged.
|
|
25
26
|
*/
|
|
26
27
|
declare function normalizeLowS(compactSignature: Uint8Array): Uint8Array;
|
|
27
28
|
/** DER → 64-byte canonical low-S compact — the conversion the signing ceremony uses. */
|
|
@@ -50,6 +51,13 @@ interface BrowserPasskeySignerOptions {
|
|
|
50
51
|
userVerification?: 'discouraged' | 'preferred' | 'required';
|
|
51
52
|
/** Inject a custom client (tests / non-browser). Defaults to `browserWebAuthnClient()`. */
|
|
52
53
|
webauthn?: WebAuthnClient;
|
|
54
|
+
/**
|
|
55
|
+
* SEC-1 (65-byte) public key of this passkey (from `create` / `connect`).
|
|
56
|
+
* WebAuthn assertions do not return the public key, so pass it here to sign
|
|
57
|
+
* for the v0.2 single-signer account; it is echoed onto the `AssertionResult`.
|
|
58
|
+
* You can instead supply it once via `SorobanSignOptions.publicKey`.
|
|
59
|
+
*/
|
|
60
|
+
publicKey?: Uint8Array;
|
|
53
61
|
}
|
|
54
62
|
/**
|
|
55
63
|
* Adapt `navigator.credentials.get` into the `WebAuthnSigner` that
|
|
@@ -80,17 +88,22 @@ declare function authEntryChallenge(entry: xdr.SorobanAuthorizationEntry, networ
|
|
|
80
88
|
|
|
81
89
|
/**
|
|
82
90
|
* Set an address-credential auth entry's signature to the `Secp256r1Signature`
|
|
83
|
-
* struct
|
|
91
|
+
* struct our v0.2 `webauthn-account` `__check_auth` consumes:
|
|
84
92
|
*
|
|
85
|
-
* ScVal::Map {
|
|
93
|
+
* ScVal::Map {
|
|
94
|
+
* authenticator_data: Bytes,
|
|
95
|
+
* client_data_json: Bytes,
|
|
96
|
+
* public_key: BytesN<65>, // the enrolled signer to verify against
|
|
97
|
+
* signature: BytesN<64>,
|
|
98
|
+
* }
|
|
86
99
|
*
|
|
87
100
|
* Map keys are alphabetical, so the ScMap is canonically sorted as Soroban
|
|
88
101
|
* requires. `signature` MUST already be 64-byte low-S compact (`signAuthEntry`
|
|
89
|
-
* normalizes before calling this).
|
|
90
|
-
*
|
|
91
|
-
*
|
|
102
|
+
* normalizes before calling this). `publicKey` names which enrolled signer the
|
|
103
|
+
* contract checks; the multi-signer account rejects a key it does not hold
|
|
104
|
+
* before any crypto runs.
|
|
92
105
|
*/
|
|
93
|
-
declare function applyAssertionToEntry(entry: xdr.SorobanAuthorizationEntry, assertion: AssertionResult): xdr.SorobanAuthorizationEntry;
|
|
106
|
+
declare function applyAssertionToEntry(entry: xdr.SorobanAuthorizationEntry, assertion: AssertionResult, publicKey: Uint8Array): xdr.SorobanAuthorizationEntry;
|
|
94
107
|
|
|
95
108
|
/**
|
|
96
109
|
* The passkey-kit / `webauthn-wallet` smart-wallet ABI target.
|
package/dist/sign.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { browserPasskeySigner, referenceCheckAuth, referenceSmartWalletCheckAuth } from './chunk-
|
|
2
|
-
export { buildAddSignerOperation, buildRemoveSignerOperation, buildSecp256r1Signer, sendSmartWalletTx } from './chunk-
|
|
3
|
-
export { applyAssertionToEntry, applyAssertionToSmartWalletEntry, authEntryChallenge, authEntryChallengeBytes, buildSignerKeyScVal, buildSmartWalletSignatureVariant, compareSignerKeyScVal, derToCompact, derToCompactLowS, isLowS, normalizeLowS, reconstructSignedPayload, signAuthEntry, signTransaction, verifyAssertionSignature } from './chunk-
|
|
1
|
+
export { browserPasskeySigner, referenceCheckAuth, referenceSmartWalletCheckAuth } from './chunk-ODXQCLZL.js';
|
|
2
|
+
export { buildAddSignerOperation, buildRemoveSignerOperation, buildSecp256r1Signer, sendSmartWalletTx } from './chunk-QREICNIW.js';
|
|
3
|
+
export { applyAssertionToEntry, applyAssertionToSmartWalletEntry, authEntryChallenge, authEntryChallengeBytes, buildSignerKeyScVal, buildSmartWalletSignatureVariant, compareSignerKeyScVal, derToCompact, derToCompactLowS, isLowS, normalizeLowS, reconstructSignedPayload, signAuthEntry, signTransaction, verifyAssertionSignature } from './chunk-XTLWH3VQ.js';
|
|
4
4
|
export { decodeChallenge, encodeChallenge, parseAuthenticatorData, parseClientDataJSON, verifyClientDataJSON, verifyRpIdHash } from './chunk-JNJ2FY45.js';
|
|
5
5
|
import './chunk-LB4HOTLV.js';
|
|
6
6
|
import './chunk-AMYFJQAC.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { xdr } from '@stellar/stellar-sdk';
|
|
2
|
-
import { S as SubmissionAdapter, c as SubmitResult } from './types
|
|
3
|
-
import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-
|
|
2
|
+
import { S as SubmissionAdapter, c as SubmitResult } from './types-CJluKV7s.cjs';
|
|
3
|
+
import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-O5d7Moma.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* passkey-kit v1 (v0.13.0, Protocol 27) smart-wallet SIGNER encoders — the WRITE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { xdr } from '@stellar/stellar-sdk';
|
|
2
|
-
import { S as SubmissionAdapter, c as SubmitResult } from './types
|
|
3
|
-
import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-
|
|
2
|
+
import { S as SubmissionAdapter, c as SubmitResult } from './types-CJluKV7s.js';
|
|
3
|
+
import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-O5d7Moma.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* passkey-kit v1 (v0.13.0, Protocol 27) smart-wallet SIGNER encoders — the WRITE
|
package/dist/testing.cjs
CHANGED
|
@@ -66,7 +66,9 @@ function buildCreateOptions(input) {
|
|
|
66
66
|
authenticatorSelection: {
|
|
67
67
|
residentKey,
|
|
68
68
|
requireResidentKey: residentKey === "required",
|
|
69
|
-
|
|
69
|
+
// The v0.2 account requires the User-Verified flag at sign time, so
|
|
70
|
+
// register with 'required' to enroll authenticators that can produce it.
|
|
71
|
+
userVerification: input.userVerification ?? "required"
|
|
70
72
|
},
|
|
71
73
|
attestation: "none",
|
|
72
74
|
timeout: input.timeout ?? 6e4
|
|
@@ -444,8 +446,20 @@ async function connect(options) {
|
|
|
444
446
|
const credentialId = storage.get(options.rpId);
|
|
445
447
|
if (!credentialId) return null;
|
|
446
448
|
const accounts = await options.indexer.resolveByCredential(credentialId);
|
|
447
|
-
const
|
|
448
|
-
return
|
|
449
|
+
const selected = selectAccount(accounts, options.publicKey);
|
|
450
|
+
return selected ? { contractId: selected.contractId, credentialId } : null;
|
|
451
|
+
}
|
|
452
|
+
function bytesEqual(a, b) {
|
|
453
|
+
if (a.length !== b.length) return false;
|
|
454
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
function selectAccount(accounts, publicKey) {
|
|
458
|
+
if (publicKey) {
|
|
459
|
+
const match = accounts.find((a) => a.publicKey && bytesEqual(a.publicKey, publicKey));
|
|
460
|
+
return match ? { contractId: match.contractId } : null;
|
|
461
|
+
}
|
|
462
|
+
return accounts[0] ?? null;
|
|
449
463
|
}
|
|
450
464
|
|
|
451
465
|
// src/ceremonies/recover.ts
|
|
@@ -565,10 +579,24 @@ function authEntryChallengeBytes(entry, networkPassphrase) {
|
|
|
565
579
|
function authEntryChallenge(entry, networkPassphrase) {
|
|
566
580
|
return bytesToBase64Url(authEntryChallengeBytes(entry, networkPassphrase));
|
|
567
581
|
}
|
|
568
|
-
function applyAssertionToEntry(entry, assertion) {
|
|
569
|
-
entry.credentials().address().signature(
|
|
582
|
+
function applyAssertionToEntry(entry, assertion, publicKey) {
|
|
583
|
+
entry.credentials().address().signature(buildSingleSignerSignatureScVal(assertion, publicKey));
|
|
570
584
|
return entry;
|
|
571
585
|
}
|
|
586
|
+
function buildSingleSignerSignatureScVal(assertion, publicKey) {
|
|
587
|
+
if (publicKey.length !== 65) {
|
|
588
|
+
throw new KitError(
|
|
589
|
+
"CONTRACT_AUTH_FAILED",
|
|
590
|
+
`single-signer signature needs a 65-byte SEC-1 public key (got ${String(publicKey.length)})`
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
return stellarSdk.xdr.ScVal.scvMap([
|
|
594
|
+
bytesField("authenticator_data", assertion.authenticatorData),
|
|
595
|
+
bytesField("client_data_json", assertion.clientDataJSON),
|
|
596
|
+
bytesField("public_key", publicKey),
|
|
597
|
+
bytesField("signature", assertion.signature)
|
|
598
|
+
]);
|
|
599
|
+
}
|
|
572
600
|
function buildSignatureScVal(assertion) {
|
|
573
601
|
return stellarSdk.xdr.ScVal.scvMap([
|
|
574
602
|
bytesField("authenticator_data", assertion.authenticatorData),
|
|
@@ -721,7 +749,14 @@ async function signEntryInPlace(entry, options) {
|
|
|
721
749
|
if (options.target === "smart-wallet") {
|
|
722
750
|
applyAssertionToSmartWalletEntry(entry, normalized);
|
|
723
751
|
} else {
|
|
724
|
-
|
|
752
|
+
const publicKey = options.publicKey ?? assertion.publicKey;
|
|
753
|
+
if (publicKey === void 0) {
|
|
754
|
+
throw new KitError(
|
|
755
|
+
"CONTRACT_AUTH_FAILED",
|
|
756
|
+
"single-signer signing requires the signer public key: set SorobanSignOptions.publicKey or return publicKey from the signer"
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
applyAssertionToEntry(entry, normalized, publicKey);
|
|
725
760
|
}
|
|
726
761
|
}
|
|
727
762
|
async function signAuthEntry(entryXdr, options) {
|
|
@@ -861,7 +896,8 @@ function mockAuthenticator(options) {
|
|
|
861
896
|
authenticatorData: a.authenticatorData,
|
|
862
897
|
clientDataJSON: a.clientDataJSON,
|
|
863
898
|
signature: a.signatureDer,
|
|
864
|
-
credentialId: credIdBytes
|
|
899
|
+
credentialId: credIdBytes,
|
|
900
|
+
publicKey
|
|
865
901
|
};
|
|
866
902
|
}
|
|
867
903
|
};
|
|
@@ -883,7 +919,9 @@ function createInMemoryBackend() {
|
|
|
883
919
|
indexer: {
|
|
884
920
|
resolveByCredential(credentialId) {
|
|
885
921
|
const account = registry.get(credentialId);
|
|
886
|
-
return Promise.resolve(
|
|
922
|
+
return Promise.resolve(
|
|
923
|
+
account ? [{ contractId: account.contractId, publicKey: account.publicKey }] : []
|
|
924
|
+
);
|
|
887
925
|
}
|
|
888
926
|
},
|
|
889
927
|
submission: {
|