@chipi-stack/backend 14.6.0 → 14.7.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/index.d.mts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +67 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -19
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.js +15 -8
- package/dist/skuPurchases.js.map +1 -1
- package/dist/skuPurchases.mjs +15 -8
- package/dist/skuPurchases.mjs.map +1 -1
- package/dist/transactions.js +15 -8
- package/dist/transactions.js.map +1 -1
- package/dist/transactions.mjs +15 -8
- package/dist/transactions.mjs.map +1 -1
- package/dist/wallets.js +41 -15
- package/dist/wallets.js.map +1 -1
- package/dist/wallets.mjs +41 -15
- package/dist/wallets.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -481,7 +481,7 @@ declare class ChipiSDK {
|
|
|
481
481
|
* });
|
|
482
482
|
* ```
|
|
483
483
|
*/
|
|
484
|
-
signTypedData({ params
|
|
484
|
+
signTypedData({ params }: {
|
|
485
485
|
params: SignTypedDataParams;
|
|
486
486
|
}): Promise<SignTypedDataResult>;
|
|
487
487
|
/**
|
|
@@ -1142,6 +1142,51 @@ declare function buildEd25519Envelope(params: {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
ownerIndex?: bigint;
|
|
1144
1144
|
}): Promise<bigint[]>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Build a V2_SNIP12 Ed25519 envelope from an **externally-produced**
|
|
1147
|
+
* signature — the Phantom / Solana flow. Phantom (and every external
|
|
1148
|
+
* Ed25519 wallet) never exposes the private key: the user signs via
|
|
1149
|
+
* `window.solana.signMessage(...)`, which returns a 64-byte signature
|
|
1150
|
+
* (R‖s). This is the from-signature counterpart of
|
|
1151
|
+
* `buildEd25519Envelope`, mirroring `buildEip191EnvelopeFromSignature`
|
|
1152
|
+
* for MetaMask.
|
|
1153
|
+
*
|
|
1154
|
+
* IMPORTANT — what the wallet MUST sign:
|
|
1155
|
+
* The wallet must sign the EXACT bytes returned by
|
|
1156
|
+
* `ed25519SignedBytes(messageHash)` — the 64-byte hex-ASCII encoding
|
|
1157
|
+
* of the SNIP-12 OE hash — NOT the raw 32-byte `messageHash`. The
|
|
1158
|
+
* Cairo verifier reconstructs those same bytes from `messageHash`, so
|
|
1159
|
+
* a mismatch fails on chain. The dashboard adapter does:
|
|
1160
|
+
* await window.solana.connect();
|
|
1161
|
+
* // Phantom returns the 32-byte Ed25519 pubkey as a Solana PublicKey;
|
|
1162
|
+
* // `.toBytes()` is the Uint8Array this API expects.
|
|
1163
|
+
* const publicKey = window.solana.publicKey.toBytes();
|
|
1164
|
+
* const msg = ed25519SignedBytes(messageHash);
|
|
1165
|
+
* // Phantom's signMessage returns { signature: Uint8Array (64B), publicKey }.
|
|
1166
|
+
* const { signature } = await window.solana.signMessage(msg);
|
|
1167
|
+
* const env = await buildEd25519EnvelopeFromSignature({
|
|
1168
|
+
* signature, publicKey, messageHash,
|
|
1169
|
+
* });
|
|
1170
|
+
*
|
|
1171
|
+
* Async (unlike the synchronous EIP-191 from-signature path): the
|
|
1172
|
+
* Garaga WASM hint builder must be initialized to produce the EC hints
|
|
1173
|
+
* the Cairo Ed25519 verifier needs. The issue sketch (#311) showed a
|
|
1174
|
+
* sync return; Ed25519 cannot avoid the WASM init that secp256k1 does.
|
|
1175
|
+
*/
|
|
1176
|
+
declare function buildEd25519EnvelopeFromSignature(params: {
|
|
1177
|
+
/** 64-byte Ed25519 signature R(32)‖s(32) from the wallet's signMessage. */
|
|
1178
|
+
signature: Uint8Array;
|
|
1179
|
+
/** 32-byte Ed25519 public key (as Phantom returns it). */
|
|
1180
|
+
publicKey: Uint8Array;
|
|
1181
|
+
/** SNIP-12 hash of the OutsideExecution — see oe.ts::computeOeHash. */
|
|
1182
|
+
messageHash: bigint;
|
|
1183
|
+
/**
|
|
1184
|
+
* Owner index in the wallet's owner_set. **Defaults to 0n (primary).**
|
|
1185
|
+
* MUST fit in u32. Same semantics + footgun as `buildEd25519Envelope`:
|
|
1186
|
+
* pass the INDEX, never an `ed25519OwnerId` commitment.
|
|
1187
|
+
*/
|
|
1188
|
+
ownerIndex?: bigint;
|
|
1189
|
+
}): Promise<bigint[]>;
|
|
1145
1190
|
|
|
1146
1191
|
/**
|
|
1147
1192
|
* EIP-191 secp256k1 signer for SHHH V8.4 ShhhAccount.
|
|
@@ -2203,4 +2248,4 @@ declare function executeShhhSponsoredRaw(params: {
|
|
|
2203
2248
|
chainId?: bigint | string;
|
|
2204
2249
|
}): Promise<string>;
|
|
2205
2250
|
|
|
2206
|
-
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, type ShhhX402Wallet, TIMELOCK_SECONDS, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, webauthnOwnerId, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|
|
2251
|
+
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, type ShhhX402Wallet, TIMELOCK_SECONDS, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, webauthnOwnerId, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -481,7 +481,7 @@ declare class ChipiSDK {
|
|
|
481
481
|
* });
|
|
482
482
|
* ```
|
|
483
483
|
*/
|
|
484
|
-
signTypedData({ params
|
|
484
|
+
signTypedData({ params }: {
|
|
485
485
|
params: SignTypedDataParams;
|
|
486
486
|
}): Promise<SignTypedDataResult>;
|
|
487
487
|
/**
|
|
@@ -1142,6 +1142,51 @@ declare function buildEd25519Envelope(params: {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
ownerIndex?: bigint;
|
|
1144
1144
|
}): Promise<bigint[]>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Build a V2_SNIP12 Ed25519 envelope from an **externally-produced**
|
|
1147
|
+
* signature — the Phantom / Solana flow. Phantom (and every external
|
|
1148
|
+
* Ed25519 wallet) never exposes the private key: the user signs via
|
|
1149
|
+
* `window.solana.signMessage(...)`, which returns a 64-byte signature
|
|
1150
|
+
* (R‖s). This is the from-signature counterpart of
|
|
1151
|
+
* `buildEd25519Envelope`, mirroring `buildEip191EnvelopeFromSignature`
|
|
1152
|
+
* for MetaMask.
|
|
1153
|
+
*
|
|
1154
|
+
* IMPORTANT — what the wallet MUST sign:
|
|
1155
|
+
* The wallet must sign the EXACT bytes returned by
|
|
1156
|
+
* `ed25519SignedBytes(messageHash)` — the 64-byte hex-ASCII encoding
|
|
1157
|
+
* of the SNIP-12 OE hash — NOT the raw 32-byte `messageHash`. The
|
|
1158
|
+
* Cairo verifier reconstructs those same bytes from `messageHash`, so
|
|
1159
|
+
* a mismatch fails on chain. The dashboard adapter does:
|
|
1160
|
+
* await window.solana.connect();
|
|
1161
|
+
* // Phantom returns the 32-byte Ed25519 pubkey as a Solana PublicKey;
|
|
1162
|
+
* // `.toBytes()` is the Uint8Array this API expects.
|
|
1163
|
+
* const publicKey = window.solana.publicKey.toBytes();
|
|
1164
|
+
* const msg = ed25519SignedBytes(messageHash);
|
|
1165
|
+
* // Phantom's signMessage returns { signature: Uint8Array (64B), publicKey }.
|
|
1166
|
+
* const { signature } = await window.solana.signMessage(msg);
|
|
1167
|
+
* const env = await buildEd25519EnvelopeFromSignature({
|
|
1168
|
+
* signature, publicKey, messageHash,
|
|
1169
|
+
* });
|
|
1170
|
+
*
|
|
1171
|
+
* Async (unlike the synchronous EIP-191 from-signature path): the
|
|
1172
|
+
* Garaga WASM hint builder must be initialized to produce the EC hints
|
|
1173
|
+
* the Cairo Ed25519 verifier needs. The issue sketch (#311) showed a
|
|
1174
|
+
* sync return; Ed25519 cannot avoid the WASM init that secp256k1 does.
|
|
1175
|
+
*/
|
|
1176
|
+
declare function buildEd25519EnvelopeFromSignature(params: {
|
|
1177
|
+
/** 64-byte Ed25519 signature R(32)‖s(32) from the wallet's signMessage. */
|
|
1178
|
+
signature: Uint8Array;
|
|
1179
|
+
/** 32-byte Ed25519 public key (as Phantom returns it). */
|
|
1180
|
+
publicKey: Uint8Array;
|
|
1181
|
+
/** SNIP-12 hash of the OutsideExecution — see oe.ts::computeOeHash. */
|
|
1182
|
+
messageHash: bigint;
|
|
1183
|
+
/**
|
|
1184
|
+
* Owner index in the wallet's owner_set. **Defaults to 0n (primary).**
|
|
1185
|
+
* MUST fit in u32. Same semantics + footgun as `buildEd25519Envelope`:
|
|
1186
|
+
* pass the INDEX, never an `ed25519OwnerId` commitment.
|
|
1187
|
+
*/
|
|
1188
|
+
ownerIndex?: bigint;
|
|
1189
|
+
}): Promise<bigint[]>;
|
|
1145
1190
|
|
|
1146
1191
|
/**
|
|
1147
1192
|
* EIP-191 secp256k1 signer for SHHH V8.4 ShhhAccount.
|
|
@@ -2203,4 +2248,4 @@ declare function executeShhhSponsoredRaw(params: {
|
|
|
2203
2248
|
chainId?: bigint | string;
|
|
2204
2249
|
}): Promise<string>;
|
|
2205
2250
|
|
|
2206
|
-
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, type ShhhX402Wallet, TIMELOCK_SECONDS, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, webauthnOwnerId, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|
|
2251
|
+
export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, type ShhhX402Wallet, TIMELOCK_SECONDS, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, webauthnOwnerId, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
|
package/dist/index.js
CHANGED
|
@@ -405,21 +405,52 @@ async function buildEd25519Envelope(params) {
|
|
|
405
405
|
);
|
|
406
406
|
}
|
|
407
407
|
const ed = await import('@noble/ed25519');
|
|
408
|
-
const garaga = await ensureGaragaInit();
|
|
409
408
|
const publicKey = await ed.getPublicKeyAsync(params.privateKey);
|
|
410
409
|
const signedBytes = ed25519SignedBytes(params.messageHash);
|
|
411
410
|
const signature = await ed.signAsync(signedBytes, params.privateKey);
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
bytesToLeBigInt(s),
|
|
417
|
-
bytesToLeBigInt(publicKey),
|
|
411
|
+
return assembleEd25519Envelope({
|
|
412
|
+
R: signature.slice(0, 32),
|
|
413
|
+
s: signature.slice(32, 64),
|
|
414
|
+
publicKey,
|
|
418
415
|
signedBytes,
|
|
416
|
+
ownerIndex
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
async function buildEd25519EnvelopeFromSignature(params) {
|
|
420
|
+
const ownerIndex = params.ownerIndex ?? 0n;
|
|
421
|
+
if (ownerIndex < 0n || ownerIndex >= 0x100000000n) {
|
|
422
|
+
throw new Error(
|
|
423
|
+
`buildEd25519EnvelopeFromSignature: ownerIndex ${ownerIndex} is out of u32 range [0, 2^32). owner_id is the u32 INDEX into the wallet's owner_set (0 for primary); do NOT pass an owner_commitment or pubkey here.`
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
if (params.signature.length !== 64) {
|
|
427
|
+
throw new Error(
|
|
428
|
+
`Ed25519 signature must be exactly 64 bytes (R\u2016s); got ${params.signature.length}.`
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
if (params.publicKey.length !== 32) {
|
|
432
|
+
throw new Error(`Ed25519 public key must be exactly 32 bytes; got ${params.publicKey.length}.`);
|
|
433
|
+
}
|
|
434
|
+
const signedBytes = ed25519SignedBytes(params.messageHash);
|
|
435
|
+
return assembleEd25519Envelope({
|
|
436
|
+
R: params.signature.slice(0, 32),
|
|
437
|
+
s: params.signature.slice(32, 64),
|
|
438
|
+
publicKey: params.publicKey,
|
|
439
|
+
signedBytes,
|
|
440
|
+
ownerIndex
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
async function assembleEd25519Envelope(parts) {
|
|
444
|
+
const garaga = await ensureGaragaInit();
|
|
445
|
+
const payload = garaga.eddsaCalldataBuilder(
|
|
446
|
+
bytesToLeBigInt(parts.R),
|
|
447
|
+
bytesToLeBigInt(parts.s),
|
|
448
|
+
bytesToLeBigInt(parts.publicKey),
|
|
449
|
+
parts.signedBytes,
|
|
419
450
|
false
|
|
420
451
|
);
|
|
421
452
|
return wrapV2Snip12Envelope({
|
|
422
|
-
ownerId: ownerIndex,
|
|
453
|
+
ownerId: parts.ownerIndex,
|
|
423
454
|
kindTag: ED25519_KIND_TAG,
|
|
424
455
|
payload
|
|
425
456
|
});
|
|
@@ -1434,12 +1465,17 @@ var ChipiWallets = class {
|
|
|
1434
1465
|
}
|
|
1435
1466
|
const isShhh = walletType === "SHHH";
|
|
1436
1467
|
const effectiveSignerKind = isShhh ? params.signerKind ?? "STARK" : void 0;
|
|
1437
|
-
const SDK_SHIPPED_SHHH_KINDS = [
|
|
1468
|
+
const SDK_SHIPPED_SHHH_KINDS = [
|
|
1469
|
+
"STARK",
|
|
1470
|
+
"ED25519",
|
|
1471
|
+
"WEBAUTHN_P256",
|
|
1472
|
+
"EIP191_SECP256K1"
|
|
1473
|
+
];
|
|
1438
1474
|
if (isShhh && !SDK_SHIPPED_SHHH_KINDS.includes(
|
|
1439
1475
|
effectiveSignerKind
|
|
1440
1476
|
)) {
|
|
1441
1477
|
throw new Error(
|
|
1442
|
-
`SHHH signerKind=${effectiveSignerKind} is not yet shipped from the SDK (
|
|
1478
|
+
`SHHH signerKind=${effectiveSignerKind} is not yet shipped from the SDK (supports STARK, ED25519, WEBAUTHN_P256, EIP191_SECP256K1). JWT_ES256_APPLE_SUB and others remain deferred to their follow-up PRs (OAuth / Apple-Developer context).`
|
|
1443
1479
|
);
|
|
1444
1480
|
}
|
|
1445
1481
|
const rpcUrl = walletType === "READY" ? shared.WALLET_RPC_ENDPOINTS.READY : shared.WALLET_RPC_ENDPOINTS.CHIPI;
|
|
@@ -1474,6 +1510,14 @@ var ChipiWallets = class {
|
|
|
1474
1510
|
pubkeyFelts = ed25519PubkeyFelts(edPubKey);
|
|
1475
1511
|
shhhPrivateKeyHex = Buffer.from(edPrivKey).toString("hex");
|
|
1476
1512
|
}
|
|
1513
|
+
} else if (effectiveSignerKind === "WEBAUTHN_P256" || effectiveSignerKind === "EIP191_SECP256K1") {
|
|
1514
|
+
if (!params.ownerPubkeyFelts || params.ownerPubkeyFelts.length !== 4) {
|
|
1515
|
+
throw new Error(
|
|
1516
|
+
`SHHH ${effectiveSignerKind} ownerPubkeyFelts must be [x_low, x_high, y_low, y_high] (4 felts); got ${params.ownerPubkeyFelts?.length ?? 0}.`
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1519
|
+
pubkeyFelts = params.ownerPubkeyFelts.map((s) => BigInt(s));
|
|
1520
|
+
shhhPrivateKeyHex = "";
|
|
1477
1521
|
} else {
|
|
1478
1522
|
throw new Error(
|
|
1479
1523
|
`SHHH signerKind=${effectiveSignerKind} reached the address-derivation block without an implementation.`
|
|
@@ -1584,12 +1628,18 @@ var ChipiWallets = class {
|
|
|
1584
1628
|
userSignature: userSignaturePayload,
|
|
1585
1629
|
typedData: typedData2,
|
|
1586
1630
|
...encryptedPrivateKey !== void 0 && { encryptedPrivateKey },
|
|
1587
|
-
// SHHH: write the signer kind to the new wallet row.
|
|
1588
|
-
// STARK-only path uses a Chipi-held STARK key, so
|
|
1589
|
-
// ownerPublicKey stays unset (encryptedPrivateKey carries
|
|
1590
|
-
// the same key the verifier checks against). External-rooted
|
|
1591
|
-
// wallets will pass ownerPublicKey instead in a follow-up PR.
|
|
1631
|
+
// SHHH: write the signer kind to the new wallet row.
|
|
1592
1632
|
...isShhh && { signerKind: effectiveSignerKind },
|
|
1633
|
+
// External-rooted SHHH (passkey / MetaMask / Phantom): no
|
|
1634
|
+
// Chipi-held key, so chipi-back needs the pubkey felts (address
|
|
1635
|
+
// derivation) + `ownerPublicKey` as the credential source it
|
|
1636
|
+
// stores (encryptedPrivateKey stays null). Canonical
|
|
1637
|
+
// ownerPublicKey = comma-joined felts. STARK / Chipi-held kinds
|
|
1638
|
+
// are untouched — encryptedPrivateKey is their credential source.
|
|
1639
|
+
...isShhh && encryptedPrivateKey === void 0 && shhhOwnerPubkeyFelts && {
|
|
1640
|
+
ownerPubkeyFelts: shhhOwnerPubkeyFelts,
|
|
1641
|
+
ownerPublicKey: shhhOwnerPubkeyFelts.join(",")
|
|
1642
|
+
},
|
|
1593
1643
|
...encryptedPrivateKeyBackup && { encryptedPrivateKeyBackup },
|
|
1594
1644
|
...params.authMethod && { authMethod: params.authMethod },
|
|
1595
1645
|
...params.credentialId && { credentialId: params.credentialId },
|
|
@@ -3190,9 +3240,7 @@ var ChipiSDK = class {
|
|
|
3190
3240
|
* });
|
|
3191
3241
|
* ```
|
|
3192
3242
|
*/
|
|
3193
|
-
async signTypedData({
|
|
3194
|
-
params
|
|
3195
|
-
}) {
|
|
3243
|
+
async signTypedData({ params }) {
|
|
3196
3244
|
return signTypedData({ params });
|
|
3197
3245
|
}
|
|
3198
3246
|
/**
|
|
@@ -4534,6 +4582,7 @@ exports.buildBootstrapSignedCall = buildBootstrapSignedCall;
|
|
|
4534
4582
|
exports.buildCancelPendingOpCall = buildCancelPendingOpCall;
|
|
4535
4583
|
exports.buildCancelRecoveryCall = buildCancelRecoveryCall;
|
|
4536
4584
|
exports.buildEd25519Envelope = buildEd25519Envelope;
|
|
4585
|
+
exports.buildEd25519EnvelopeFromSignature = buildEd25519EnvelopeFromSignature;
|
|
4537
4586
|
exports.buildEip191EnvelopeFromPrivateKey = buildEip191EnvelopeFromPrivateKey;
|
|
4538
4587
|
exports.buildEip191EnvelopeFromSignature = buildEip191EnvelopeFromSignature;
|
|
4539
4588
|
exports.buildExecuteAddOwnerCall = buildExecuteAddOwnerCall;
|