Use a cloud key management service as a secure signer for your Crossmint wallet.
A Cloud KMS signer uses a signing key generated and stored inside a cloud key management service — AWS KMS, Azure Key Vault, or GCP Cloud HSM. The key is non-extractable by design: no employee at your company (or at the cloud provider) can ever retrieve the raw key material.Cloud KMS signers support advanced enterprise security controls natively, including IP allowlisting, cloud IAM-based access policies, rate limiting, circuit breakers, and detailed audit logs and alerting.For a conceptual overview, see Cloud KMS Signers in the Signers concept page. To learn how to register additional operational signers on an existing wallet, see Registering a signer.
Navigate to Cloud Key Management in the Google Cloud Marketplace and click Enable.
2
Create a Key Ring
Go to Security > Key Management in the Google Cloud Console and click Create Key Ring.
Key ring name:crossmint-keys (or your preferred name)
Location: Select a region, e.g. us-west1
3
Create an Asymmetric Signing Key
Inside your key ring, click Create Key with the following settings:
Setting
Value
Key name
my-crossmint-wallet-key
Protection level
HSM (Hardware Security Module)
Key material
HSM-generated key
Purpose
Asymmetric Sign
Algorithm
Elliptic Curve secp256k1 - SHA256 Digest
You must use the secp256k1 curve for EVM-compatible wallets. Other curves (e.g. P-256) will not produce valid Ethereum signatures.
4
Download the Public Key
Once the key is created, click on the key version, select Get Public Key, and download it in PEM format.Save the contents — you will need this PEM string in later steps. It looks like:
-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE...-----END PUBLIC KEY-----
Region: Same region as your key ring (e.g. us-west1)
Runtime: Node.js 18+
Authentication: Configure based on your security requirements
For production, restrict access to your Cloud Run function using IAM authentication or VPC Service Controls. Allowing unauthenticated access is only suitable for development.
2
Set Environment Variables
In the Cloud Run function settings, go to the Containers tab, expand Edit Container, then select the Variables & Secrets tab. Add the following environment variables. To get these values, use Copy resource name from the same key version actions menu where you downloaded the public key — it gives you a path like projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/VERSION.
Variable
Example Value
PROJECT_ID
crossmint-test-462521
LOCATION
us-west1
KEY_RING
crossmint-keys
KEY_NAME
my-crossmint-wallet-key
VERSION
1
3
Add the Function Code
Set the Function entry point to signDigest, then paste the following code:
Now wire everything together — convert your KMS public key to an Ethereum address, create a Crossmint wallet, and sign transactions through your Cloud Run function.
Google Cloud KMS returns public keys in PEM/DER format. This helper extracts the raw public key bytes and converts them to an Ethereum address using viem.
kms-utils.ts
import { publicKeyToAddress } from "viem/accounts";import { AsnParser } from "@peculiar/asn1-schema";import { SubjectPublicKeyInfo } from "@peculiar/asn1-x509";import { Buffer } from "buffer";export const publicKeyPem = `-----BEGIN PUBLIC KEY-----YOUR_PUBLIC_KEY_HERE-----END PUBLIC KEY-----`;export function kmsPemToEthAddress(pem: string): `0x${string}` { const b64 = pem.replace( /-----BEGIN PUBLIC KEY-----|-----END PUBLIC KEY-----|\s+/g, "" ); const der = Uint8Array.from(Buffer.from(b64, "base64")); const spki = AsnParser.parse(der, SubjectPublicKeyInfo); const publicKeyHex = `0x${Buffer.from( new Uint8Array(spki.subjectPublicKey) ).toString("hex")}` as `0x${string}`; return publicKeyToAddress(publicKeyHex);}
Use the KMS-derived Ethereum address as the wallet’s recovery method. The recovery method is used for wallet recovery and adding new signers — ideal for a server-held KMS key.
Key rotation caveat: While Cloud KMS supports automatic key rotation,
rotating an asymmetric signing key generates a new key pair — which means a
new Ethereum address. For wallets, manage key versions carefully and plan
migrations accordingly.
Restrict Cloud Run access: Use IAM authentication or VPC Service Controls to ensure only authorized services can call your signing function.
Enable audit logs: Turn on Cloud KMS “Data Access” audit logs to track every signing operation.
Principle of least privilege: Only grant the signerVerifier role — never grant admin or encrypterDecrypter roles to your signing service account.
Environment variables: Never hardcode your Crossmint API key or GCP credentials. Use environment variables or a secrets manager.
This guide is written for EVM-compatible blockchains. The steps for Solana or Stellar are similar, but key
settings change. Contact your Crossmint support representative for assistance.
1
Access AWS KMS
Log in to your AWS account and search for “KMS” in the AWS Console. Navigate to the Key Management Service.
2
Create a Customer Managed Key
Go to Customer managed keys and click Create key.
3
Configure Key Settings
Configure your key with the following settings:
Setting
Value
Key type
Asymmetric
Key usage
Sign and verify
Key spec
ECC_SECG_P256K1
The ECC_SECG_P256K1 specification is the secp256k1 elliptic curve, which is the same curve used by Ethereum and other EVM-compatible blockchains for cryptographic operations.
4
Name Your Key
Give your key a descriptive alias that identifies its purpose, for example: my-crossmint-wallet-key.
5
Set Permissions
Specify the key administrators and users who should have access to manage and use this key.
6
Copy the Public Key
After creating the key, navigate to the key’s detail page and go to the Public key tab. Click Download
to download the public key in PEM format, or copy the public key content directly.Save the contents — you will need this PEM string in later steps. It looks like:
-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE...-----END PUBLIC KEY-----
Save this public key securely. You will need it in the next step to derive the Ethereum address for your wallet signer.
Next, create an IAM role that allows your Lambda function to call KMS for signing operations.
In this guide, an AWS Lambda function handles signing requests. However, this architecture can be adapted
to run on other compute types such as EC2 instances or ECS containers depending on your infrastructure
requirements.
1
Create a New Role
Search for “IAM” in the AWS Console, navigate to Roles, and click Create role.
2
Configure Role Type
Keep AWS service selected and choose Lambda under “Service or use case”.
3
Skip Permission Policies
Skip the permission policies step for now (you will add an inline policy next).
4
Name the Role
Give your role a descriptive name, for example: kms-signer-role.
5
Add Inline Policy
From within the new role page, select Add Permissions and then Create inline policy.
6
Configure the Policy
Set the Policy editor to JSON and add the following policy:
Now create a Lambda function that will handle signing requests using your KMS key.
1
Create the Function
Search for “Lambda” in the AWS Console and click Create function. Give your function a name, for example: kms-signer-function.
2
Configure Execution Role
Under Change default execution role, select Use an existing role. From the Existing role dropdown, select the role you created during IAM Role Setup (e.g., kms-signer-role).
3
Set Environment Variables
Create a new environment variable KMS_KEY_ID and set it to your KMS key ID. You can find the key ID at the top of the KMS key’s dashboard page.
4
Add the Function Code
Enter the following code in the Lambda function editor:
View Lambda Function Code
import { KMSClient, SignCommand } from '@aws-sdk/client-kms'const kms = new KMSClient({})const KEY_ID = process.env.KMS_KEY_IDif (!KEY_ID) throw new Error('Missing env var KMS_KEY_ID')// secp256k1 curve parametersconst SECP256K1_P = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F')const SECP256K1_N = BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141')const SECP256K1_HALF_N = SECP256K1_N / 2nconst SECP256K1_Gx = BigInt('0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798')const SECP256K1_Gy = BigInt('0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8')export const handler = async (event) => { const body = typeof event.body === 'string' ? JSON.parse(event.body) : (event.body ?? event) const digestInput = body.userOpHash ?? body.useropHash ?? body.hash ?? body.digest if (!digestInput) { return resp(400, { error: 'Missing userOpHash (0x..32 bytes) or digest (0x..32 bytes or base64 32 bytes)' }) } const signerAddress = body.signerAddress if (!signerAddress || !signerAddress.startsWith('0x') || signerAddress.length !== 42) { return resp(400, { error: 'Missing or invalid signerAddress (must be 0x-prefixed 20-byte hex address)' }) } const digestBytes = parse32ByteDigest(digestInput) if (!digestBytes) return resp(400, { error: 'Digest must be 32 bytes (hex 0x.. or base64)' }) // Apply EIP-191 personal sign prefix before signing // This computes: keccak256("\x19Ethereum Signed Message:\n32" + digestBytes) const ethSignedHash = hashMessage(digestBytes) const out = await kms.send( new SignCommand({ KeyId: KEY_ID, Message: ethSignedHash, MessageType: 'DIGEST', SigningAlgorithm: 'ECDSA_SHA_256' }) ) if (!out.Signature) return resp(500, { error: 'KMS did not return a signature' }) let { r, s } = derToRS(Buffer.from(out.Signature)) // Enforce low-s (EIP-2) let sBig = BigInt(s) let sFlipped = false if (sBig > SECP256K1_HALF_N) { sBig = SECP256K1_N - sBig s = toPaddedHex(sBig, 32) sFlipped = true } // Determine the correct recovery parameter by trying both and comparing addresses const rBig = BigInt(r) const hashBig = BigInt('0x' + Buffer.from(ethSignedHash).toString('hex')) let correctV = null const recoveredAddresses = [] for (const recoveryParam of [0, 1]) { try { const recoveredPubKey = ecrecover(hashBig, rBig, sBig, recoveryParam) if (!recoveredPubKey) { recoveredAddresses.push({ v: recoveryParam + 27, error: 'recovery returned null' }) continue } const recoveredAddress = pubKeyToAddress(recoveredPubKey) recoveredAddresses.push({ v: recoveryParam + 27, address: recoveredAddress }) if (recoveredAddress.toLowerCase() === signerAddress.toLowerCase()) { correctV = recoveryParam + 27 break } } catch (err) { recoveredAddresses.push({ v: recoveryParam + 27, error: err.message }) } } if (correctV === null) { return resp(500, { error: 'Failed to determine correct signature recovery parameter. Verify signerAddress matches the KMS key.', debug: { expectedAddress: signerAddress, recoveredAddresses, r, s } }) } const signature = hexConcat([r, s, toPaddedHex(BigInt(correctV), 1)]) return { statusCode: 200, headers: { 'content-type': 'application/json' }, body: JSON.stringify({ signature }) }}function resp(statusCode, body) { return { statusCode, headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }}// EIP-191 personal sign: keccak256("\x19Ethereum Signed Message:\n" + len + message)function hashMessage(messageBytes) { const prefix = Buffer.from(`\x19Ethereum Signed Message:\n${messageBytes.length}`, 'utf8') const prefixedMessage = Buffer.concat([prefix, messageBytes]) return Buffer.from(keccak256(prefixedMessage))}function parse32ByteDigest(input) { if (typeof input !== 'string') return null if (input.startsWith('0x')) { try { const bytes = Buffer.from(input.slice(2), 'hex') return bytes.length === 32 ? bytes : null } catch { return null } } try { const bytes = Buffer.from(input, 'base64') return bytes.length === 32 ? bytes : null } catch { return null }}function derToRS(der) { let i = 0 if (der[i++] !== 0x30) throw new Error('Invalid DER: expected SEQUENCE') const seq = readDerLen(der, i) i = seq.next if (der[i++] !== 0x02) throw new Error('Invalid DER: expected INTEGER (r)') const rLen = readDerLen(der, i) i = rLen.next const rBytes = der.slice(i, i + rLen.len) i += rLen.len if (der[i++] !== 0x02) throw new Error('Invalid DER: expected INTEGER (s)') const sLen = readDerLen(der, i) i = sLen.next const sBytes = der.slice(i, i + sLen.len) return { r: bytesToPaddedHex(stripLeadingZero(rBytes), 32), s: bytesToPaddedHex(stripLeadingZero(sBytes), 32) }}function readDerLen(buf, offset) { const first = buf[offset] if (first < 0x80) return { len: first, next: offset + 1 } const n = first & 0x7f let len = 0 for (let j = 0; j < n; j++) len = (len << 8) | buf[offset + 1 + j] return { len, next: offset + 1 + n }}function stripLeadingZero(b) { return (b.length > 1 && b[0] === 0x00) ? b.slice(1) : b}function bytesToPaddedHex(b, size) { return '0x' + Buffer.from(b).toString('hex').padStart(size * 2, '0')}function toPaddedHex(n, size) { let hex = n.toString(16) if (hex.length > size * 2) hex = hex.slice(-size * 2) return '0x' + hex.padStart(size * 2, '0')}function hexConcat(parts) { return '0x' + parts.map((p) => (p.startsWith('0x') ? p.slice(2) : p)).join('')}// ============================================================================// Pure JavaScript secp256k1 ecrecover implementation// ============================================================================// Modular arithmetic helpersfunction mod(a, m) { const result = a % m return result >= 0n ? result : result + m}function modInverse(a, m) { a = mod(a, m) // Ensure a is positive before computing inverse if (a === 0n) throw new Error('No modular inverse for 0') let [old_r, r] = [a, m] let [old_s, s] = [1n, 0n] while (r !== 0n) { const q = old_r / r ;[old_r, r] = [r, old_r - q * r] ;[old_s, s] = [s, old_s - q * s] } return mod(old_s, m)}function modPow(base, exp, m) { let result = 1n base = mod(base, m) while (exp > 0n) { if (exp % 2n === 1n) result = mod(result * base, m) exp = exp / 2n base = mod(base * base, m) } return result}// Elliptic curve point operations (affine coordinates)function pointAdd(p1, p2) { if (p1 === null) return p2 if (p2 === null) return p1 const [x1, y1] = p1 const [x2, y2] = p2 if (x1 === x2) { if (y1 !== y2) return null // point at infinity // Point doubling const s = mod(3n * x1 * x1 * modInverse(2n * y1, SECP256K1_P), SECP256K1_P) const x3 = mod(s * s - 2n * x1, SECP256K1_P) const y3 = mod(s * (x1 - x3) - y1, SECP256K1_P) return [x3, y3] } const s = mod((y2 - y1) * modInverse(x2 - x1, SECP256K1_P), SECP256K1_P) const x3 = mod(s * s - x1 - x2, SECP256K1_P) const y3 = mod(s * (x1 - x3) - y1, SECP256K1_P) return [x3, y3]}function pointMul(k, point) { let result = null let addend = point while (k > 0n) { if (k & 1n) result = pointAdd(result, addend) addend = pointAdd(addend, addend) k >>= 1n } return result}// Recover y-coordinate from x-coordinate on secp256k1function recoverY(x, isOdd) { // y² = x³ + 7 (mod p) const ySquared = mod(modPow(x, 3n, SECP256K1_P) + 7n, SECP256K1_P) // y = ySquared^((p+1)/4) mod p (works because p ≡ 3 mod 4) const y = modPow(ySquared, (SECP256K1_P + 1n) / 4n, SECP256K1_P) // Verify if (mod(y * y, SECP256K1_P) !== ySquared) return null // Return the y with correct parity const yIsOdd = (y & 1n) === 1n return yIsOdd === isOdd ? y : mod(-y, SECP256K1_P)}// ecrecover: recover public key from signaturefunction ecrecover(msgHash, r, s, recoveryParam) { // Recover the point R from r and recoveryParam const isOdd = (recoveryParam & 1) === 1 const x = r const y = recoverY(x, isOdd) if (y === null) return null const R = [x, y] const G = [SECP256K1_Gx, SECP256K1_Gy] // Public key P = r^(-1) * (s*R - e*G) const rInv = modInverse(r, SECP256K1_N) const u1 = mod(-msgHash * rInv, SECP256K1_N) const u2 = mod(s * rInv, SECP256K1_N) const point1 = pointMul(u1, G) const point2 = pointMul(u2, R) const pubKeyPoint = pointAdd(point1, point2) if (pubKeyPoint === null) return null // Return uncompressed public key (65 bytes: 0x04 || x || y) const xHex = pubKeyPoint[0].toString(16).padStart(64, '0') const yHex = pubKeyPoint[1].toString(16).padStart(64, '0') return Buffer.from('04' + xHex + yHex, 'hex')}function pubKeyToAddress(pubKey) { // Skip the 0x04 prefix and hash the 64 bytes const hash = keccak256(pubKey.slice(1)) return '0x' + Buffer.from(hash.slice(12)).toString('hex')}// ============================================================================// Pure JavaScript Keccak-256 implementation (no external dependencies)// ============================================================================const KECCAK_ROUNDS = 24const ROTC = [1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44]const PILN = [10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1]const RNDC = [ 0x0000000000000001n, 0x0000000000008082n, 0x800000000000808an, 0x8000000080008000n, 0x000000000000808bn, 0x0000000080000001n, 0x8000000080008081n, 0x8000000000008009n, 0x000000000000008an, 0x0000000000000088n, 0x0000000080008009n, 0x000000008000000an, 0x000000008000808bn, 0x800000000000008bn, 0x8000000000008089n, 0x8000000000008003n, 0x8000000000008002n, 0x8000000000000080n, 0x000000000000800an, 0x800000008000000an, 0x8000000080008081n, 0x8000000000008080n, 0x0000000080000001n, 0x8000000080008008n]function rotl64(x, n) { n = BigInt(n) return ((x << n) | (x >> (64n - n))) & 0xffffffffffffffffn}function keccakF(state) { for (let round = 0; round < KECCAK_ROUNDS; round++) { // Theta const C = new Array(5) for (let x = 0; x < 5; x++) { C[x] = state[x] ^ state[x + 5] ^ state[x + 10] ^ state[x + 15] ^ state[x + 20] } const D = new Array(5) for (let x = 0; x < 5; x++) { D[x] = C[(x + 4) % 5] ^ rotl64(C[(x + 1) % 5], 1) } for (let x = 0; x < 5; x++) { for (let y = 0; y < 5; y++) { state[x + y * 5] ^= D[x] } } // Rho and Pi let t = state[1] for (let i = 0; i < 24; i++) { const j = PILN[i] const temp = state[j] state[j] = rotl64(t, ROTC[i]) t = temp } // Chi for (let y = 0; y < 5; y++) { const row = [state[y * 5], state[y * 5 + 1], state[y * 5 + 2], state[y * 5 + 3], state[y * 5 + 4]] for (let x = 0; x < 5; x++) { state[y * 5 + x] = row[x] ^ ((~row[(x + 1) % 5]) & row[(x + 2) % 5]) } } // Iota state[0] ^= RNDC[round] }}function keccak256(input) { const inputBytes = Buffer.isBuffer(input) ? input : Buffer.from(input) const rate = 136 // (1600 - 256 * 2) / 8 for keccak-256 const state = new Array(25).fill(0n) // Pad the input: append 0x01, then zeros, then 0x80 const padLen = rate - (inputBytes.length % rate) const padded = Buffer.alloc(inputBytes.length + padLen) inputBytes.copy(padded) padded[inputBytes.length] = 0x01 padded[padded.length - 1] |= 0x80 // Absorb for (let offset = 0; offset < padded.length; offset += rate) { for (let i = 0; i < rate / 8; i++) { const lane = padded.readBigUInt64LE(offset + i * 8) state[i] ^= lane } keccakF(state) } // Squeeze (just 32 bytes for keccak-256) const output = Buffer.alloc(32) for (let i = 0; i < 4; i++) { output.writeBigUInt64LE(state[i], i * 8) } return output}
5
Deploy the Function
Click Deploy to save and deploy your Lambda function
6
Expose Function as HTTP Endpoint
Make the function accessible to your application via an HTTP endpoint.The simplest approach is to enable a Lambda Function URL — a built-in HTTPS endpoint with no extra infrastructure:
1
Open your Lambda function
In the AWS Console, navigate to your Lambda function and go to the Configuration tab.
2
Create Function URL
Select Function URL in the left panel, then click Create function URL.
3
Set Auth Type
Choose NONE for auth type (simplest for development). For production, use AWS_IAM and sign requests with SigV4.
4
Copy the URL
Copy the Function URL — you will use this as KMS_SIGNER_URL in your application code.
A Function URL with auth type NONE is publicly accessible. For production, use AWS_IAM auth
or put the Lambda behind an API Gateway with IAM authorization. See the advanced setup below.
Advanced: Create an API Gateway with IAM Auth
For production, you can expose the function via API Gateway with IAM authorization.
This requires AWS SigV4-signed requests (e.g., via awscurl).
1
Create the API
Search for “API Gateway” in the AWS Console and click Create API. Select Build for REST API.
2
Configure API Settings
Name your API (e.g., KMS Sign API) and select a security policy that meets your requirements.
3
Create a Method
After creating the API, select Create method with the following settings:
Setting
Value
Method type
POST
Lambda function
Select the Lambda function you created
Authorization (In Method Request Settings)
AWS IAM
4
Create a Stage
Go to Stages in the left panel and click Create Stage. Name the stage (e.g., prod).
5
Deploy the API
Go back to API > Resource and select Deploy API. Select the stage you created and click Deploy.
6
Add Resource Policy
Navigate to Resource policy in the left panel and add the following policy to allow invocations from your AWS account:
Click your profile icon in the top-right corner of AWS Console
API_ID
Found in the API Gateway console URL or in the API’s ARN
STAGE
The stage name you created (e.g., prod)
Click Next, give the policy a name (e.g., api-gateway-invoke-policy), and click Create policy.
Test Using AWS CLI
You can invoke the function using the AWS CLI to ensure everything is working correctly.
1
Open Security Credentials
Click on your username in the top right corner of the AWS Console, then select Security credentials from the dropdown menu.
2
Create Access Key
Scroll down to the Access keys section and click Create access key.
3
Select Use Case
Select the use case (e.g., “Command Line Interface (CLI)”) and click Create access key.
4
Copy Access Keys
Important: Copy both the Access key ID and Secret access key immediately. The secret access key will only be shown once and cannot be retrieved later.
5
Run AWS Configure
Run aws configure to set up your AWS credentials:
aws configure
6
Enter Access Key ID
When prompted, enter your AWS Access Key ID: Paste the access key ID you copied in the previous step.
7
Enter Secret Access Key
Enter your AWS Secret Access Key: Paste the secret access key you copied.
8
Enter Default Region
Enter your Default region name: Enter your AWS region (e.g., us-east-1, eu-north-1).
9
Set Output Format
For Default output format: Press Enter to use the default (JSON) or specify json, yaml, text, or table.Your credentials will be stored in ~/.aws/credentials and your configuration in ~/.aws/config.
10
Install awscurl
Install awscurl to make signed requests to your API:
pip install awscurl
11
Generate Signature
Run the following command to sign a message using your endpoint:
Found in the API Gateway console URL or ARN (e.g., if ARN is arn:aws:execute-api:eu-north-1:257027486036:bho48fe8dl/*/POST/, then API_ID is bho48fe8dl)
BASE64_ENCODED_MESSAGE_HASH
The base64-encoded message hash returned from wallet APIs
0xYOUR_KMS_SIGNER_ADDRESS
The Ethereum address derived from your KMS public key (from step 3)
Now wire everything together — convert your KMS public key to an Ethereum address, create a Crossmint wallet, and sign transactions through your Lambda function.
AWS KMS provides the public key in PEM format. You need to convert it to an Ethereum address. The code below
handles this conversion by parsing the PEM-encoded public key and deriving the corresponding Ethereum address.
Replace the publicKeyPem placeholder with the public key you copied from AWS KMS in the previous step.
kms-utils.ts
import { publicKeyToAddress } from "viem/accounts";import { AsnParser } from "@peculiar/asn1-schema";import { SubjectPublicKeyInfo } from "@peculiar/asn1-x509";import { Buffer } from "buffer";// Paste the public key from your AWS KMS key hereexport const publicKeyPem = `-----BEGIN PUBLIC KEY-----YOUR_KMS_PUBLIC_KEY_HERE-----END PUBLIC KEY-----`;function pemToDer(pem: string): Uint8Array { const b64 = pem .replace(/-----BEGIN PUBLIC KEY-----/g, "") .replace(/-----END PUBLIC KEY-----/g, "") .replace(/\s+/g, ""); return Uint8Array.from(Buffer.from(b64, "base64"));}export function kmsPemToEthAddress(pem: string): `0x${string}` { const der = pemToDer(pem); // Parse SPKI and extract the BIT STRING (the actual EC point bytes) const spki = AsnParser.parse(der, SubjectPublicKeyInfo); const uncompressed = new Uint8Array(spki.subjectPublicKey); // 65 bytes: 04 || X || Y if (uncompressed.length !== 65 || uncompressed[0] !== 0x04) { throw new Error("Expected uncompressed secp256k1 public key (65 bytes starting with 0x04)."); } const publicKeyHex = `0x${Buffer.from(uncompressed).toString("hex")}` as `0x${string}`; return publicKeyToAddress(publicKeyHex);}
The @peculiar/asn1-schema and @peculiar/asn1-x509 packages were already installed in the “Install Dependencies” step above.
The Lambda function from the previous step handles DER-to-Ethereum signature conversion and EIP-2 low-s normalization. This client-side function calls your Lambda and returns the resulting signature:
This example uses a plain fetch call, which works with Lambda Function URLs (auth type NONE). If you set up API Gateway with IAM auth instead, you will need to sign requests with AWS SigV4 — use awscurl for testing (see the “Test Using AWS CLI” section above).
Use the KMS-derived Ethereum address as the wallet’s recovery method. The recovery method is used for wallet recovery and adding new signers — ideal for a server-held KMS key.
Key rotation caveat: While AWS KMS supports automatic key rotation,
rotating an asymmetric signing key generates a new key pair — which means a
new Ethereum address. For wallets, manage key versions carefully and plan
migrations accordingly.
Restrict Lambda access: Use IAM authentication or VPC endpoints to ensure only authorized services can call your signing function.
Enable audit logs: Turn on AWS CloudTrail to log all KMS and Lambda operations.
Principle of least privilege: Only grant kms:Sign and kms:GetPublicKey — never grant broader KMS permissions to your signing role.
Environment variables: Never hardcode your Crossmint API key or AWS credentials. Use environment variables or AWS Secrets Manager.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Crossmint Docs","colors":{"primary":"#36b37e","light":"#87ff8f","dark":"#001d01"},"logo":{"light":"https://mintcdn.com/crossmint/a8gPOTKEuVFcSfC3/logo/crossmint-light.png?fit=max\u0026auto=format\u0026n=a8gPOTKEuVFcSfC3\u0026q=85\u0026s=8c2671e4c8f7da6956e1508bd68c2928","dark":"https://mintcdn.com/crossmint/a8gPOTKEuVFcSfC3/logo/crossmint-dark.png?fit=max\u0026auto=format\u0026n=a8gPOTKEuVFcSfC3\u0026q=85\u0026s=272ecc17664d17b9ff24471758ff80b2"},"favicon":"https://mintcdn.com/crossmint/xq66q9GV6z6jjj95/favicon.png?fit=max\u0026auto=format\u0026n=xq66q9GV6z6jjj95\u0026q=85\u0026s=00fb89ddf6ba5b1022b9307039c08006","api":{"openapi":["api-reference/_open-api/MintingAPIs.json","api-reference/_open-api/AdminAPIs.json","api-reference/_open-api/VerifiableCredentialsAPIs.json","api-reference/_open-api/Wallets.json"],"examples":{"prefill":true}},"background":{"color":{"dark":"#090b0c"}},"navbar":{"links":[{"href":"https://www.crossmint.com/contact","label":"Support"},{"href":"https://staging.crossmint.com/console","label":"Staging Console"}],"primary":{"type":"button","label":"Console","href":"https://www.crossmint.com/console"}},"footer":{"socials":{"website":"https://www.crossmint.com","twitter":"https://twitter.com/crossmint","github":"https://github.com/crossmint"}},"integrations":{"ga4":{"measurementId":"G-CP5EDD6GVT"},"posthog":{"apiKey":"phc_tfgodwfjuO9v3Nw0tIWJNzACoi2opL7X2Ly0Mg2UCTz","apiHost":"https://eu.i.posthog.com","sessionRecording":false}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"crossmint","hasAudioNarration":false,"actualSubdomain":"crossmint","customDomains":["docs.crossmint.com"],"gitSource":{"type":"github","owner":"paella-labs","repo":"crossbit-main","deployBranch":"main","contentDirectory":"apps/crossmint-mintlify-docs/src","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true,"contextualFeedback":{"allowEmail":true},"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af465d8911eab1428db13c3","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"API Reference","count":1094},{"language":"default","tag":"Wallets","count":870},{"language":"default","tag":"Kotlin SDK","count":427},{"language":"default","tag":"Swift SDK","count":237},{"language":"default","tag":"Checkout","count":196},{"language":"default","tag":"Classes","count":182},{"language":"default","tag":"Data Classes","count":182},{"language":"default","tag":"Typescript SDK","count":156},{"language":"default","tag":"Guides","count":134},{"language":"default","tag":"Structs","count":127}]},"assistantConfig":{"enableAskAiButton":true,"enableStarterQuestions":false,"enableAskAiSearchBar":false,"deflection":{"enabled":true,"type":"link","url":"https://www.crossmint.com/contact/sales"}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".tab-container [data-component-part=\"tabs-list\"]{flex-wrap:wrap;overflow:visible;row-gap:0.25rem}.tab-container [data-component-part=\"tabs-list\"]>li{white-space:nowrap}.nav-dropdown-item,.nav-dropdown-item *{font-weight:500!important;color:rgb(75, 85, 99)!important}.nav-dropdown-item:hover,.nav-dropdown-item:hover *{color:rgb(31, 41, 55)!important}.dark .nav-dropdown-item,.dark .nav-dropdown-item *{color:rgb(156, 163, 175)!important}.dark .nav-dropdown-item:hover,.dark .nav-dropdown-item:hover *{color:rgb(209, 213, 219)!important}"}],"page":{"pagePath":"wallets/guides/signers/cloud-kms","slug":"/wallets/guides/signers/cloud-kms","pageMetadata":{"title":"Cloud KMS Signers","description":"Use a cloud key management service as a secure signer for your Crossmint wallet.","href":"/wallets/guides/signers/cloud-kms"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use a cloud key management service as a secure signer for your Crossmint wallet.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,hr:`hr`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,CodeBlock,CodeGroup,Heading,Info,Note,OptimizedImage,Step,Steps,Tab,Table,Tabs,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`A Cloud KMS signer uses a signing key generated and stored inside a cloud key management service — AWS KMS, Azure Key Vault, or GCP Cloud HSM. The key is non-extractable by design: no employee at your company (or at the cloud provider) can ever retrieve the raw key material.`}),`\n`,_jsx(_components.p,{children:`Cloud KMS signers support advanced enterprise security controls natively, including IP allowlisting, cloud IAM-based access policies, rate limiting, circuit breakers, and detailed audit logs and alerting.`}),`\n`,_jsxs(_components.p,{children:[`For a conceptual overview, see `,_jsx(_components.a,{href:`/wallets/concepts/signers#cloud-kms-signers`,children:`Cloud KMS Signers`}),` in the Signers concept page. To learn how to register additional operational signers on an existing wallet, see `,_jsx(_components.a,{href:`/wallets/guides/signers/add-signers`,children:`Registering a signer`}),`.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Google Cloud KMS`,id:`google-cloud-kms`,\"data-child-heading-ids\":`[\"how-it-works\",\"what-you-will-build\",\"prerequisites\",\"set-up-google-cloud-kms\",\"set-up-iam-permissions\",\"deploy-a-cloud-run-signing-function\",\"create-and-use-the-crossmint-wallet\",\"install-dependencies\",\"convert-the-kms-public-key-to-an-ethereum-address\",\"build-the-kms-signing-function\",\"create-the-wallet\",\"use-the-wallet\",\"security-best-practices\"]`,children:[_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How It Works`}),_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`You create a signing key inside Google Cloud KMS — the private key never leaves Google’s hardware.`}),`\n`,_jsx(_components.li,{children:`A Cloud Run function sits in front of KMS and signs transaction digests on demand.`}),`\n`,_jsx(_components.li,{children:`The Crossmint SDK calls your Cloud Run function whenever the wallet needs to sign something.`}),`\n`,_jsx(_components.li,{children:`The signature is converted from Google’s format to Ethereum’s format, and the Crossmint SDK uses it to complete the transaction.`}),`\n`]}),_jsx(_components.p,{children:`That is it — your key stays in the HSM, and Crossmint never sees it.`}),_jsx(Heading,{level:`2`,id:`what-you-will-build`,children:`What You Will Build`}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`An asymmetric signing key in Google Cloud KMS (secp256k1)`}),`\n`,_jsx(_components.li,{children:`A Cloud Run function that signs digests via KMS`}),`\n`,_jsx(_components.li,{children:`A Crossmint server wallet using your KMS key as its signer`}),`\n`]}),_jsx(Heading,{level:`3`,id:`prerequisites`,children:`Prerequisites`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A `,_jsx(`a`,{href:`https://console.cloud.google.com/`,target:`_blank`,children:`Google Cloud`}),` project with billing enabled`]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.a,{href:`/introduction/platform/api-keys`,children:`Crossmint server API key`})]}),`\n`,_jsx(_components.li,{children:`Node.js 18+`}),`\n`]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`set-up-google-cloud-kms`,children:`Set Up Google Cloud KMS`}),_jsxs(Steps,{children:[_jsx(Step,{title:`Enable the Cloud KMS API`,children:_jsxs(_components.p,{children:[`Navigate to `,_jsx(`a`,{href:`https://console.cloud.google.com/marketplace/product/google/cloudkms.googleapis.com`,target:`_blank`,children:`Cloud Key Management`}),` in the Google Cloud Marketplace and click `,_jsx(_components.strong,{children:`Enable`}),`.`]})}),_jsxs(Step,{title:`Create a Key Ring`,children:[_jsxs(_components.p,{children:[`Go to `,_jsx(_components.strong,{children:`Security > Key Management`}),` in the Google Cloud Console and click `,_jsx(_components.strong,{children:`Create Key Ring`}),`.`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=def05377a58df56f4b832bba4d7eb550`,alt:`Create a key ring`,\"data-og-width\":`1132`,width:`1132`,\"data-og-height\":`1030`,height:`1030`,\"data-path\":`images/wallets/guides/create-key-ring.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=280\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=78a73b18c47b0de59b8263cc2bb7f8a8 280w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=560\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=ff31954a8e55b9bda5436a499ccbc4a0 560w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=840\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=306b6c3df6ff0e6e6198e04fb6079056 840w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=1100\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=fc8a7b9ef876516f5568ca59b1ea81c0 1100w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=1650\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=a3b6245966817e9f2b205b2d9c544436 1650w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key-ring.png?w=2500\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=07d74db5edf71fe7568944fce3c5b361 2500w`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Key ring name:`}),` `,_jsx(_components.code,{children:`crossmint-keys`}),` (or your preferred name)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Location:`}),` Select a region, e.g. `,_jsx(_components.code,{children:`us-west1`})]}),`\n`]})]}),_jsxs(Step,{title:`Create an Asymmetric Signing Key`,children:[_jsxs(_components.p,{children:[`Inside your key ring, click `,_jsx(_components.strong,{children:`Create Key`}),` with the following settings:`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=80d7b8d101555ebbb0428cfb0b72ca0f`,alt:`Create a key`,\"data-og-width\":`1260`,width:`1260`,\"data-og-height\":`1254`,height:`1254`,\"data-path\":`images/wallets/guides/create-key.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=280\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=7de91b29d4f8de3c6fc7ebc87a47017a 280w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=560\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=0f169a153363c55dc9b61658b23df844 560w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=840\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=84d986bf109fcc49b06904ca26089ed7 840w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=1100\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=2173ef18bd6fd467a67ce266f39de0ac 1100w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=1650\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=62e3f2557a54bac246b4aac4574fb1d8 1650w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/create-key.png?w=2500\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=009a8e7e343833dc43f1464d185cffed 2500w`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Setting`}),_jsx(_components.th,{children:`Value`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Key name`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`my-crossmint-wallet-key`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Protection level`})}),_jsx(_components.td,{children:`HSM (Hardware Security Module)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Key material`})}),_jsx(_components.td,{children:`HSM-generated key`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Purpose`})}),_jsx(_components.td,{children:`Asymmetric Sign`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Algorithm`})}),_jsx(_components.td,{children:`Elliptic Curve secp256k1 - SHA256 Digest`})]})]})]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`You `,_jsx(_components.strong,{children:`must`}),` use the `,_jsx(_components.code,{children:`secp256k1`}),` curve for EVM-compatible wallets. Other curves (e.g. P-256) will not produce valid Ethereum signatures.`]})})]}),_jsxs(Step,{title:`Download the Public Key`,children:[_jsxs(_components.p,{children:[`Once the key is created, click on the key version, select `,_jsx(_components.strong,{children:`Get Public Key`}),`, and download it in PEM format.`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=455989c42586b615c4b4921f3170c061`,alt:`Download the public key`,\"data-og-width\":`544`,width:`544`,\"data-og-height\":`316`,height:`316`,\"data-path\":`images/wallets/guides/get-public-key.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=280\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=190d9dd71e710ba9ba9f5034b1ffa515 280w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=560\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=2f7aa7d52185faaa7762e1016d26f2ae 560w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=840\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=5294b1ecb0fb45a284cfc240c3563d8e 840w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=1100\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=eee4d56472d8c32084823f85c2930fda 1100w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=1650\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=64dad48d9162bc24eaff0cdb01abddb9 1650w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/get-public-key.png?w=2500\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=892978d57cf7a26e7c4d17dc6bdf3f21 2500w`}),_jsx(_components.p,{children:`Save the contents — you will need this PEM string in later steps. It looks like:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`-----BEGIN PUBLIC KEY-----`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`-----END PUBLIC KEY-----`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`set-up-iam-permissions`,children:`Set Up IAM Permissions`}),_jsxs(Steps,{children:[_jsx(Step,{title:`Create a Service Account`,children:_jsxs(_components.p,{children:[`Navigate to `,_jsx(_components.strong,{children:`IAM \u0026 Admin > Service Accounts`}),` and create a new service account (e.g. `,_jsx(_components.code,{children:`kms-signer-sa`}),`).`]})}),_jsxs(Step,{title:`Grant KMS Permissions`,children:[_jsx(_components.p,{children:`Assign the following role to the service account:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Role:`}),` `,_jsx(_components.code,{children:`Cloud KMS CryptoKey Signer/Verifier`}),` (`,_jsx(_components.code,{children:`roles/cloudkms.signerVerifier`}),`)`]}),`\n`]}),_jsx(Note,{children:_jsx(_components.p,{children:`This follows the principle of least privilege — the service account can only sign and verify, not manage or destroy keys.`})})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`deploy-a-cloud-run-signing-function`,children:`Deploy a Cloud Run Signing Function`}),_jsx(_components.p,{children:`This function receives a digest, signs it with your KMS key, and returns the DER-encoded signature.`}),_jsxs(Steps,{children:[_jsxs(Step,{title:`Create a Cloud Run Function`,children:[_jsxs(_components.p,{children:[`Go to `,_jsx(`a`,{href:`https://console.cloud.google.com/run/create`,target:`_blank`,children:`Cloud Run Functions`}),` and create a new function:`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Name:`}),` `,_jsx(_components.code,{children:`kms-signer-function`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Region:`}),` Same region as your key ring (e.g. `,_jsx(_components.code,{children:`us-west1`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Runtime:`}),` Node.js 18+`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Authentication:`}),` Configure based on your security requirements`]}),`\n`]}),_jsx(Warning,{children:_jsx(_components.p,{children:`For production, restrict access to your Cloud Run function using IAM authentication or VPC Service Controls. Allowing unauthenticated access is only suitable for development.`})})]}),_jsxs(Step,{title:`Set Environment Variables`,children:[_jsxs(_components.p,{children:[`In the Cloud Run function settings, go to the `,_jsx(_components.strong,{children:`Containers`}),` tab, expand `,_jsx(_components.strong,{children:`Edit Container`}),`, then select the `,_jsx(_components.strong,{children:`Variables \u0026 Secrets`}),` tab. Add the following environment variables. To get these values, use `,_jsx(_components.strong,{children:`Copy resource name`}),` from the same key version actions menu where you downloaded the public key — it gives you a path like `,_jsx(_components.code,{children:`projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/VERSION`}),`.`]}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Variable`}),_jsx(_components.th,{children:`Example Value`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`PROJECT_ID`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`crossmint-test-462521`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`LOCATION`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`us-west1`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`KEY_RING`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`crossmint-keys`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`KEY_NAME`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`my-crossmint-wallet-key`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`VERSION`})}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`1`})})]})]})]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=5abcc116e72433e17f1ffe2f332bcbbd`,alt:`Add environment variables to container`,\"data-og-width\":`768`,width:`768`,\"data-og-height\":`533`,height:`533`,\"data-path\":`images/wallets/guides/add-environment-variables.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=280\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=676135a41b43f8433b373a786572d939 280w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=560\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=b7650345d4f9e2a6149cac24ed1731ee 560w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=840\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=e99fa280bcc7580d91863a6d8fe15e52 840w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=1100\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=8bb3ab7baf8ff019001729a4ff08dd63 1100w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=1650\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=29782923322589ffc1b4a3e0185f46aa 1650w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/add-environment-variables.png?w=2500\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=3554020ad9d90328803d8a831760c8ab 2500w`})]}),_jsxs(Step,{title:`Add the Function Code`,children:[_jsxs(_components.p,{children:[`Set the `,_jsx(_components.strong,{children:`Function entry point`}),` to `,_jsx(_components.code,{children:`signDigest`}),`, then paste the following code:`]}),_jsx(CodeBlock,{filename:`index.js`,numberOfLines:`27`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { KeyManagementServiceClient } = require(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"@google-cloud/kms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KeyManagementServiceClient();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`exports.signDigest = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (req, res) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { digest } = req.body;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` keyName = client.cryptoKeyVersionPath(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` process.env.PROJECT_ID,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` process.env.LOCATION,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` process.env.KEY_RING,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` process.env.KEY_NAME,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` process.env.VERSION || `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [signResponse] = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.asymmetricSign({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` name: keyName,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` digest: { sha256: Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(digest, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res.status(200).send({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` derSignature: Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(signResponse.signature).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (error) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res.status(500).send({ error: error.message });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),_jsxs(_components.p,{children:[`Add `,_jsx(_components.code,{children:`@google-cloud/kms`}),` to your function’s `,_jsx(_components.code,{children:`package.json`}),` dependencies:`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=a4fad41772aa7c9a28f623c778e1ec90`,alt:`Add the google kms dependency`,\"data-og-width\":`430`,width:`430`,\"data-og-height\":`138`,height:`138`,\"data-path\":`images/wallets/guides/cloud-function-kms-dep.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=280\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=0b58d632c6fd264630b4c241ea93642b 280w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=560\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=ca00c4a64f8dc35cc8124590bc30394f 560w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=840\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=81723c3937777fa2fd2e8b8b1f1ea200 840w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=1100\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=050f4c94730eb01f8424b5b80d433b59 1100w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=1650\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=05560147e7f21ed5f28c5a2ac87d37aa 1650w, https://mintcdn.com/crossmint/28uGfVqBDY4tqVuy/images/wallets/guides/cloud-function-kms-dep.png?w=2500\u0026fit=max\u0026auto=format\u0026n=28uGfVqBDY4tqVuy\u0026q=85\u0026s=ced49052e3c1585a3a15667cefc5c317 2500w`})]}),_jsxs(Step,{title:`Deploy and Test`,children:[_jsxs(_components.p,{children:[`Deploy the function and note the `,_jsx(_components.strong,{children:`URL`}),` — you will need it in the next step.`]}),_jsx(_components.p,{children:`Test with a sample request:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` -X POST https://YOUR_FUNCTION_URL \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` -H `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` -d `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'{\"digest\": \"abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890\"}'`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`You should receive a JSON response containing a `,_jsx(_components.code,{children:`derSignature`}),` field.`]})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`create-and-use-the-crossmint-wallet`,children:`Create and Use the Crossmint Wallet`}),_jsx(_components.p,{children:`Now wire everything together — convert your KMS public key to an Ethereum address, create a Crossmint wallet, and sign transactions through your Cloud Run function.`}),_jsx(Heading,{level:`3`,id:`install-dependencies`,children:`Install Dependencies`}),_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`npm`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`yarn`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`yarn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`pnpm`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`bun`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})})]}),_jsx(Heading,{level:`3`,id:`convert-the-kms-public-key-to-an-ethereum-address`,children:`Convert the KMS Public Key to an Ethereum Address`}),_jsxs(_components.p,{children:[`Google Cloud KMS returns public keys in PEM/DER format. This helper extracts the raw public key bytes and converts them to an Ethereum address using `,_jsx(_components.code,{children:`viem`}),`.`]}),_jsx(CodeBlock,{filename:`kms-utils.ts`,numberOfLines:`21`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { publicKeyToAddress } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"viem/accounts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { AsnParser } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@peculiar/asn1-schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { SubjectPublicKeyInfo } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@peculiar/asn1-x509\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { Buffer } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"buffer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyPem = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`-----BEGIN PUBLIC KEY-----\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`YOUR_PUBLIC_KEY_HERE`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"-----END PUBLIC KEY-----`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` kmsPemToEthAddress(pem: string): `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` b64 = pem.replace(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` /-----BEGIN PUBLIC KEY-----|-----END PUBLIC KEY-----|\\\\s+/g,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` der = Uint8Array.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(b64, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base64\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` spki = AsnParser.parse(der, SubjectPublicKeyInfo);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyHex = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${Buffer.from(\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` new Uint8Array(spki.subjectPublicKey)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' ).toString(\"hex\")}`'}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyToAddress(publicKeyHex);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`build-the-kms-signing-function`,children:`Build the KMS Signing Function`}),_jsxs(_components.p,{children:[`Cloud KMS returns DER-encoded signatures. Ethereum requires `,_jsx(_components.code,{children:`r`}),`, `,_jsx(_components.code,{children:`s`}),`, `,_jsx(_components.code,{children:`v`}),` format with `,_jsx(`a`,{href:`https://eips.ethereum.org/EIPS/eip-2`,target:`_blank`,children:`EIP-2 low-s normalization`}),`. This function handles the full conversion:`]}),_jsx(CodeBlock,{filename:`kms-signer.ts`,numberOfLines:`71`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`71`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { hashMessage, recoverPublicKey } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"viem\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { publicKeyToAddress } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"viem/accounts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { Buffer } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"buffer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KMS_SIGNER_URL = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://YOUR_CLOUD_FUNCTION_URL\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_N =`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_HALF_N = SECP256K1_N / 2n;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` derToRS(derHex: string): { r: bigint; s: bigint } {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytes = Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(derHex, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` offset = 2; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// skip 0x30 + length byte`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` offset++; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// skip 0x02 tag for r`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rLen = bytes[offset++];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + bytes.slice(offset, offset + rLen).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` offset += rLen;`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` offset++; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// skip 0x02 tag for s`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sLen = bytes[offset++];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + bytes.slice(offset, offset + sLen).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { r, s };`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bigintToHex(value: bigint): `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:' `0x${value.toString(16).padStart(64, \"0\")}`'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`): Promise\u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` digest = hashMessage({ raw: message });`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fetch(KMS_SIGNER_URL, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` method: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` headers: { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body: JSON.stringify({ digest: digest.slice(2) }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!response.ok) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`KMS signing failed: ${response.statusText}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { derSignature } = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { r, s } = derToRS(derSignature);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // EIP-2 low-s normalization`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (s > SECP256K1_HALF_N) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s = SECP256K1_N - s;`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rHex = bigintToHex(r);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sHex = bigintToHex(s);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` expectedAddress = kmsPemToEthAddress(publicKeyPem);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Recover v by trying both 27 and 28`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` v `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [27n, 28n]) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sig = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`${rHex}${sHex.slice(2)}${\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` v === 27n ? \"1b\" : \"1c\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" }`\"}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recovered = publicKeyToAddress(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoverPublicKey({ hash: digest, signature: sig })`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (recovered.toLowerCase() === expectedAddress.toLowerCase()) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sig;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Could not recover valid signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`create-the-wallet`,children:`Create the Wallet`}),_jsx(_components.p,{children:`Use the KMS-derived Ethereum address as the wallet’s recovery method. The recovery method is used for wallet recovery and adding new signers — ideal for a server-held KMS key.`}),_jsx(CodeBlock,{filename:`create-wallet.ts`,numberOfLines:`22`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { CrossmintWallets, createCrossmint } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@crossmint/wallets-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { signWithKms } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-signer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmint = createCrossmint({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` apiKey: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_CROSSMINT_SERVER_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets = CrossmintWallets.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(crossmint);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets.createWallet({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` chain: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base-sepolia\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveryMethods: [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"external-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` address: kmsPemToEthAddress(publicKeyPem),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` onSign: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (message) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` alias: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"my-crossmint-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`use-the-wallet`,children:`Use the Wallet`}),_jsx(_components.p,{children:`Once created, retrieve the wallet and use it to sign transactions. Here are a couple of examples:`}),_jsx(CodeBlock,{filename:`use-wallet.ts`,numberOfLines:`28`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`28`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { EVMWallet } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@crossmint/wallets-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { signWithKms } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-signer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { crossmintWallets } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./create-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets.getWallet(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"evm:alias:my-crossmint-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { chain: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base-sepolia\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet.useSigner({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"external-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` address: kmsPemToEthAddress(publicKeyPem),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` onSign: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (message) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Example: Send tokens`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet.send(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xRecipientAddress\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"usdxm\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Example: Send a raw EVM transaction`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` evmWallet = EVMWallet.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(wallet);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` evmWallet.sendTransaction({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xRecipientAddress\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value: BigInt(0),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`security-best-practices`,children:`Security Best Practices`}),_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Key rotation caveat:`}),` While Cloud KMS supports automatic key rotation,\nrotating an asymmetric signing key generates a new key pair — which means a\nnew Ethereum address. For wallets, manage key versions carefully and plan\nmigrations accordingly.`]})}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Restrict Cloud Run access:`}),` Use IAM authentication or VPC Service Controls to ensure only authorized services can call your signing function.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Enable audit logs:`}),` Turn on Cloud KMS “Data Access” audit logs to track every signing operation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Principle of least privilege:`}),` Only grant the `,_jsx(_components.code,{children:`signerVerifier`}),` role — never grant `,_jsx(_components.code,{children:`admin`}),` or `,_jsx(_components.code,{children:`encrypterDecrypter`}),` roles to your signing service account.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Environment variables:`}),` Never hardcode your Crossmint API key or GCP credentials. Use environment variables or a secrets manager.`]}),`\n`]})]}),_jsxs(Tab,{title:`AWS KMS`,id:`aws-kms`,\"data-child-heading-ids\":`[\"how-it-works-2\",\"what-you-will-build-2\",\"prerequisites-2\",\"set-up-aws-kms\",\"set-up-iam-permissions-2\",\"deploy-a-lambda-signing-function\",\"create-and-use-the-crossmint-wallet-2\",\"install-dependencies-2\",\"convert-the-kms-public-key-to-an-ethereum-address-2\",\"build-the-kms-signing-function-2\",\"create-the-wallet-2\",\"use-the-wallet-2\",\"security-best-practices-2\"]`,children:[_jsx(Heading,{level:`2`,id:`how-it-works-2`,children:`How It Works`}),_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`You create an asymmetric signing key inside AWS KMS — the private key never leaves AWS hardware security modules (HSMs).`}),`\n`,_jsx(_components.li,{children:`An AWS Lambda function sits in front of KMS and signs transaction digests on demand.`}),`\n`,_jsx(_components.li,{children:`The Crossmint SDK calls your Lambda function whenever the wallet needs to sign something.`}),`\n`,_jsxs(_components.li,{children:[`The signature is converted from AWS’s DER format to Ethereum’s `,_jsx(_components.code,{children:`r, s, v`}),` format, and the Crossmint SDK uses it to complete the transaction.`]}),`\n`]}),_jsx(_components.p,{children:`That is it — your key stays in the HSM, and Crossmint never sees it.`}),_jsx(Heading,{level:`2`,id:`what-you-will-build-2`,children:`What You Will Build`}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`An asymmetric signing key in AWS KMS (secp256k1)`}),`\n`,_jsx(_components.li,{children:`An IAM role scoped to KMS signing operations`}),`\n`,_jsx(_components.li,{children:`A Lambda function that signs digests via KMS`}),`\n`,_jsx(_components.li,{children:`A Crossmint server wallet using your KMS key as its signer`}),`\n`]}),_jsx(Heading,{level:`3`,id:`prerequisites-2`,children:`Prerequisites`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`An `,_jsx(`a`,{href:`https://aws.amazon.com/console/`,target:`_blank`,children:`AWS account`}),` with appropriate permissions to create KMS keys, IAM roles, Lambda functions, and API Gateway resources`]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.a,{href:`/introduction/platform/api-keys`,children:`Crossmint server API key`})]}),`\n`,_jsx(_components.li,{children:`Node.js 18+`}),`\n`]}),_jsxs(Accordion,{title:`Required AWS IAM Permissions`,id:`required-aws-iam-permissions`,children:[_jsx(_components.p,{children:`To complete this setup, your AWS user or role will need the following permissions:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Permission`}),_jsx(_components.th,{children:`Purpose`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`kms:CreateKey`})}),_jsx(_components.td,{children:`Create the KMS asymmetric key for signing`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`iam:CreateRole`})}),_jsx(_components.td,{children:`Create the IAM role for Lambda execution`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`iam:PutRolePolicy`})}),_jsx(_components.td,{children:`Attach inline policies to the IAM role`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`iam:PutGroupPolicy`})}),_jsx(_components.td,{children:`Configure group-level policies if needed`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`ec2:DescribeVpcEndpoints`})}),_jsx(_components.td,{children:`Configure VPC endpoints for private API access`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`apigateway:UpdateRestApiPolicy`})}),_jsx(_components.td,{children:`Update API Gateway resource policies`})]})]})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`set-up-aws-kms`,children:`Set Up AWS KMS`}),_jsx(Note,{children:_jsxs(_components.p,{children:[`This guide is written for `,_jsx(_components.strong,{children:`EVM-compatible blockchains`}),`. The steps for Solana or Stellar are similar, but key\nsettings change. Contact your Crossmint support representative for assistance.`]})}),_jsxs(Steps,{children:[_jsx(Step,{title:`Access AWS KMS`,children:_jsxs(_components.p,{children:[`Log in to your AWS account and search for “KMS” in the AWS Console. Navigate to the `,_jsx(_components.strong,{children:`Key Management Service`}),`.`]})}),_jsx(Step,{title:`Create a Customer Managed Key`,children:_jsxs(_components.p,{children:[`Go to `,_jsx(_components.strong,{children:`Customer managed keys`}),` and click `,_jsx(_components.strong,{children:`Create key`}),`.`]})}),_jsxs(Step,{title:`Configure Key Settings`,children:[_jsx(_components.p,{children:`Configure your key with the following settings:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Setting`}),_jsx(_components.th,{children:`Value`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Key type`}),_jsx(_components.td,{children:`Asymmetric`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Key usage`}),_jsx(_components.td,{children:`Sign and verify`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Key spec`}),_jsx(_components.td,{children:`ECC_SECG_P256K1`})]})]})]}),_jsx(Info,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`ECC_SECG_P256K1`}),` specification is the secp256k1 elliptic curve, which is the same curve used by Ethereum and other EVM-compatible blockchains for cryptographic operations.`]})})]}),_jsx(Step,{title:`Name Your Key`,children:_jsxs(_components.p,{children:[`Give your key a descriptive alias that identifies its purpose, for example: `,_jsx(_components.code,{children:`my-crossmint-wallet-key`}),`.`]})}),_jsx(Step,{title:`Set Permissions`,children:_jsx(_components.p,{children:`Specify the key administrators and users who should have access to manage and use this key.`})}),_jsxs(Step,{title:`Copy the Public Key`,children:[_jsxs(_components.p,{children:[`After creating the key, navigate to the key’s detail page and go to the `,_jsx(_components.strong,{children:`Public key`}),` tab. Click `,_jsx(_components.strong,{children:`Download`}),`\nto download the public key in PEM format, or copy the public key content directly.`]}),_jsx(_components.p,{children:`Save the contents — you will need this PEM string in later steps. It looks like:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`-----BEGIN PUBLIC KEY-----`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`-----END PUBLIC KEY-----`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsx(Warning,{children:_jsx(_components.p,{children:`Save this public key securely. You will need it in the next step to derive the Ethereum address for your wallet signer.`})})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`set-up-iam-permissions-2`,children:`Set Up IAM Permissions`}),_jsx(_components.p,{children:`Next, create an IAM role that allows your Lambda function to call KMS for signing operations.`}),_jsx(Info,{children:_jsxs(_components.p,{children:[`In this guide, an `,_jsx(_components.strong,{children:`AWS Lambda function`}),` handles signing requests. However, this architecture can be adapted\nto run on other compute types such as `,_jsx(_components.strong,{children:`EC2 instances`}),` or `,_jsx(_components.strong,{children:`ECS containers`}),` depending on your infrastructure\nrequirements.`]})}),_jsxs(Steps,{children:[_jsx(Step,{title:`Create a New Role`,children:_jsxs(_components.p,{children:[`Search for “IAM” in the AWS Console, navigate to `,_jsx(_components.strong,{children:`Roles`}),`, and click `,_jsx(_components.strong,{children:`Create role`}),`.`]})}),_jsx(Step,{title:`Configure Role Type`,children:_jsxs(_components.p,{children:[`Keep `,_jsx(_components.strong,{children:`AWS service`}),` selected and choose `,_jsx(_components.strong,{children:`Lambda`}),` under “Service or use case”.`]})}),_jsx(Step,{title:`Skip Permission Policies`,children:_jsx(_components.p,{children:`Skip the permission policies step for now (you will add an inline policy next).`})}),_jsx(Step,{title:`Name the Role`,children:_jsxs(_components.p,{children:[`Give your role a descriptive name, for example: `,_jsx(_components.code,{children:`kms-signer-role`}),`.`]})}),_jsx(Step,{title:`Add Inline Policy`,children:_jsxs(_components.p,{children:[`From within the new role page, select `,_jsx(_components.strong,{children:`Add Permissions`}),` and then `,_jsx(_components.strong,{children:`Create inline policy`}),`.`]})}),_jsxs(Step,{title:`Configure the Policy`,children:[_jsxs(_components.p,{children:[`Set the `,_jsx(_components.strong,{children:`Policy editor`}),` to `,_jsx(_components.strong,{children:`JSON`}),` and add the following policy:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Version\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2012-10-17\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Statement\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Effect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Allow\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kms:Sign\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kms:GetPublicKey\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Resource\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:`Replace the placeholders with your actual values:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Placeholder`}),_jsx(_components.th,{children:`Where to Find It`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`REGION`})}),_jsxs(_components.td,{children:[`Your AWS region (e.g., `,_jsx(_components.code,{children:`us-east-1`}),`, `,_jsx(_components.code,{children:`eu-north-1`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`ACCOUNT_ID`})}),_jsx(_components.td,{children:`Click your profile icon in the top-right corner of AWS Console`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`KEY_ID`})}),_jsx(_components.td,{children:`Found on your KMS key’s dashboard page`})]})]})]}),_jsx(Note,{children:_jsx(_components.p,{children:`This follows the principle of least privilege — the role can only sign and get the public key, not manage or destroy keys.`})})]}),_jsx(Step,{title:`Save the Policy`,children:_jsxs(_components.p,{children:[`Name the policy (e.g., `,_jsx(_components.code,{children:`kms.policy`}),`) and click “Create policy”.`]})})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`deploy-a-lambda-signing-function`,children:`Deploy a Lambda Signing Function`}),_jsx(_components.p,{children:`Now create a Lambda function that will handle signing requests using your KMS key.`}),_jsxs(Steps,{children:[_jsx(Step,{title:`Create the Function`,children:_jsxs(_components.p,{children:[`Search for “Lambda” in the AWS Console and click `,_jsx(_components.strong,{children:`Create function`}),`. Give your function a name, for example: `,_jsx(_components.code,{children:`kms-signer-function`}),`.`]})}),_jsx(Step,{title:`Configure Execution Role`,children:_jsxs(_components.p,{children:[`Under `,_jsx(_components.strong,{children:`Change default execution role`}),`, select `,_jsx(_components.strong,{children:`Use an existing role`}),`. From the `,_jsx(_components.strong,{children:`Existing role`}),` dropdown, select the role you created during IAM Role Setup (e.g., `,_jsx(_components.code,{children:`kms-signer-role`}),`).`]})}),_jsxs(Step,{title:`Set Environment Variables`,children:[_jsxs(_components.p,{children:[`Create a new environment variable `,_jsx(_components.code,{children:`KMS_KEY_ID`}),` and set it to your KMS key ID. You can find the key ID at the top of the KMS key’s dashboard page.`]}),_jsx(OptimizedImage,{src:`https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=cad48fffe929f6ff7485707243188c0e`,alt:`KMS Key ID`,\"data-og-width\":`1374`,width:`1374`,\"data-og-height\":`186`,height:`186`,\"data-path\":`images/wallets/guides/aws-kms-key-id.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=280\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=2398a170fb22d5812a8723fec60b9a61 280w, https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=560\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=d5324c40c56f52872fc67621f39e096b 560w, https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=840\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=3ab502170f5c1ac169f580247a5c34c3 840w, https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=1100\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=eee96dc85801f8e7a89843c37069c71c 1100w, https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=1650\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=8ecf5b510f9f3b8b6185f2186dac4e46 1650w, https://mintcdn.com/crossmint/P2fqFOr8u8ChWCzr/images/wallets/guides/aws-kms-key-id.png?w=2500\u0026fit=max\u0026auto=format\u0026n=P2fqFOr8u8ChWCzr\u0026q=85\u0026s=43e52cab09ee3abfd810fbb3d3aea368 2500w`})]}),_jsxs(Step,{title:`Add the Function Code`,children:[_jsx(_components.p,{children:`Enter the following code in the Lambda function editor:`}),_jsx(Accordion,{title:`View Lambda Function Code`,id:`view-lambda-function-code`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`382`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`382`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { KMSClient, SignCommand } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@aws-sdk/client-kms'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` kms = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KMSClient({})`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KEY_ID = process.env.KMS_KEY_ID`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!KEY_ID) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Missing env var KMS_KEY_ID'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// secp256k1 curve parameters`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_P = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_N = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_HALF_N = SECP256K1_N / 2n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_Gx = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SECP256K1_Gy = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` handler = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (event) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`typeof`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` event.body === `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'string'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ? JSON.parse(event.body) : (event.body ?? event)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` digestInput = body.userOpHash ?? body.useropHash ?? body.hash ?? body.digest`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!digestInput) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(400, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Missing userOpHash (0x..32 bytes) or digest (0x..32 bytes or base64 32 bytes)'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signerAddress = body.signerAddress`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!signerAddress || !signerAddress.startsWith(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) || signerAddress.length !== 42) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(400, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Missing or invalid signerAddress (must be 0x-prefixed 20-byte hex address)'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` digestBytes = parse32ByteDigest(digestInput)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!digestBytes) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(400, { error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Digest must be 32 bytes (hex 0x.. or base64)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Apply EIP-191 personal sign prefix before signing`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // This computes: keccak256(\"\\\\x19Ethereum Signed Message:\\\\n32\" + digestBytes)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ethSignedHash = hashMessage(digestBytes)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` out = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` kms.send(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SignCommand({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KeyId: KEY_ID,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Message: ethSignedHash,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MessageType: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'DIGEST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SigningAlgorithm: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'ECDSA_SHA_256'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!out.Signature) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(500, { error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'KMS did not return a signature'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { r, s } = derToRS(Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(out.Signature))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Enforce low-s (EIP-2)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sBig = BigInt(s)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sFlipped = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`false`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (sBig > SECP256K1_HALF_N) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sBig = SECP256K1_N - sBig`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s = toPaddedHex(sBig, 32)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sFlipped = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Determine the correct recovery parameter by trying both and comparing addresses`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rBig = BigInt(r)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hashBig = BigInt(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ethSignedHash).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` correctV = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddresses = []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveryParam `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [0, 1]) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredPubKey = ecrecover(hashBig, rBig, sBig, recoveryParam)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!recoveredPubKey) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddresses.push({ v: recoveryParam + 27, error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'recovery returned null'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` continue`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddress = pubKeyToAddress(recoveredPubKey)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddresses.push({ v: recoveryParam + 27, address: recoveredAddress })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (recoveredAddress.toLowerCase() === signerAddress.toLowerCase()) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` correctV = recoveryParam + 27`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (err) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddresses.push({ v: recoveryParam + 27, error: err.message })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (correctV === `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(500, { `})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Failed to determine correct signature recovery parameter. Verify signerAddress matches the KMS key.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` debug: {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` expectedAddress: signerAddress,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveredAddresses,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signature = hexConcat([r, s, toPaddedHex(BigInt(correctV), 1)])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` statusCode: 200,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` headers: { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body: JSON.stringify({ signature })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp(statusCode, body) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { statusCode, headers: { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, body: JSON.stringify(body) }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// EIP-191 personal sign: keccak256(\"\\\\x19Ethereum Signed Message:\\\\n\" + len + message)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hashMessage(messageBytes) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prefix = Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\\\\x19Ethereum Signed Message:\\\\n${messageBytes.length}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'utf8'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prefixedMessage = Buffer.concat([prefix, messageBytes])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(keccak256(prefixedMessage))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` parse32ByteDigest(input) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`typeof`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` input !== `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'string'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (input.startsWith(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytes = Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(input.slice(2), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytes.length === 32 ? bytes : `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytes = Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(input, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'base64'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytes.length === 32 ? bytes : `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` derToRS(der) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = 0`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (der[i++] !== 0x30) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Invalid DER: expected SEQUENCE'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` seq = readDerLen(der, i)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = seq.next`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (der[i++] !== 0x02) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Invalid DER: expected INTEGER (r)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rLen = readDerLen(der, i)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = rLen.next`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rBytes = der.slice(i, i + rLen.len)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i += rLen.len`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (der[i++] !== 0x02) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Invalid DER: expected INTEGER (s)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sLen = readDerLen(der, i)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = sLen.next`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sBytes = der.slice(i, i + sLen.len)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { r: bytesToPaddedHex(stripLeadingZero(rBytes), 32), s: bytesToPaddedHex(stripLeadingZero(sBytes), 32) }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` readDerLen(buf, offset) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` first = buf[offset]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (first \u003c 0x80) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { len: first, next: offset + 1 }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n = first \u0026 0x7f`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` len = 0`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` j = 0; j \u003c n; j++) len = (len \u003c\u003c 8) | buf[offset + 1 + j]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { len, next: offset + 1 + n }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stripLeadingZero(b) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (b.length > 1 \u0026\u0026 b[0] === 0x00) ? b.slice(1) : b`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytesToPaddedHex(b, size) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(b).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).padStart(size * 2, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` toPaddedHex(n, size) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hex = n.toString(16)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (hex.length > size * 2) hex = hex.slice(-size * 2)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + hex.padStart(size * 2, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hexConcat(parts) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + parts.map((p) => (p.startsWith(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) ? p.slice(2) : p)).join(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`''`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ============================================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Pure JavaScript secp256k1 ecrecover implementation`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ============================================================================`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Modular arithmetic helpers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mod(a, m) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result = a % m`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result >= 0n ? result : result + m`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modInverse(a, m) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` a = mod(a, m) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Ensure a is positive before computing inverse`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (a === 0n) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'No modular inverse for 0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [old_r, r] = [a, m]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [old_s, s] = [1n, 0n]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (r !== 0n) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` q = old_r / r`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ;[old_r, r] = [r, old_r - q * r]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ;[old_s, s] = [s, old_s - q * s]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mod(old_s, m)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` modPow(base, exp, m) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result = 1n`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base = mod(base, m)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (exp > 0n) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (exp % 2n === 1n) result = mod(result * base, m)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` exp = exp / 2n`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base = mod(base * base, m)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Elliptic curve point operations (affine coordinates)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pointAdd(p1, p2) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (p1 === `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (p2 === `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [x1, y1] = p1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [x2, y2] = p2`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (x1 === x2) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (y1 !== y2) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // point at infinity`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Point doubling`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s = mod(3n * x1 * x1 * modInverse(2n * y1, SECP256K1_P), SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x3 = mod(s * s - 2n * x1, SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y3 = mod(s * (x1 - x3) - y1, SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [x3, y3]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` s = mod((y2 - y1) * modInverse(x2 - x1, SECP256K1_P), SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x3 = mod(s * s - x1 - x2, SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y3 = mod(s * (x1 - x3) - y1, SECP256K1_P)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [x3, y3]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pointMul(k, point) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` addend = point`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (k > 0n) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (k \u0026 1n) result = pointAdd(result, addend)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` addend = pointAdd(addend, addend)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` k >>= 1n`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Recover y-coordinate from x-coordinate on secp256k1`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoverY(x, isOdd) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // y² = x³ + 7 (mod p)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ySquared = mod(modPow(x, 3n, SECP256K1_P) + 7n, SECP256K1_P)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // y = ySquared^((p+1)/4) mod p (works because p ≡ 3 mod 4)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y = modPow(ySquared, (SECP256K1_P + 1n) / 4n, SECP256K1_P)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Verify`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (mod(y * y, SECP256K1_P) !== ySquared) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Return the y with correct parity`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yIsOdd = (y \u0026 1n) === 1n`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yIsOdd === isOdd ? y : mod(-y, SECP256K1_P)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ecrecover: recover public key from signature`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ecrecover(msgHash, r, s, recoveryParam) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Recover the point R from r and recoveryParam`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` isOdd = (recoveryParam \u0026 1) === 1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x = r`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y = recoverY(x, isOdd)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (y === `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` R = [x, y]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` G = [SECP256K1_Gx, SECP256K1_Gy]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Public key P = r^(-1) * (s*R - e*G)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rInv = modInverse(r, SECP256K1_N)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` u1 = mod(-msgHash * rInv, SECP256K1_N)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` u2 = mod(s * rInv, SECP256K1_N)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` point1 = pointMul(u1, G)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` point2 = pointMul(u2, R)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pubKeyPoint = pointAdd(point1, point2)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (pubKeyPoint === `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Return uncompressed public key (65 bytes: 0x04 || x || y)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` xHex = pubKeyPoint[0].toString(16).padStart(64, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yHex = pubKeyPoint[1].toString(16).padStart(64, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'04'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + xHex + yHex, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pubKeyToAddress(pubKey) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Skip the 0x04 prefix and hash the 64 bytes`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hash = keccak256(pubKey.slice(1))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` + Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(hash.slice(12)).toString(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ============================================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Pure JavaScript Keccak-256 implementation (no external dependencies)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ============================================================================`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KECCAK_ROUNDS = 24`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ROTC = [1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PILN = [10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` RNDC = [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x0000000000000001n, 0x0000000000008082n, 0x800000000000808an, 0x8000000080008000n,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x000000000000808bn, 0x0000000080000001n, 0x8000000080008081n, 0x8000000000008009n,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x000000000000008an, 0x0000000000000088n, 0x0000000080008009n, 0x000000008000000an,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x000000008000808bn, 0x800000000000008bn, 0x8000000000008089n, 0x8000000000008003n,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x8000000000008002n, 0x8000000000000080n, 0x000000000000800an, 0x800000008000000an,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x8000000080008081n, 0x8000000000008080n, 0x0000000080000001n, 0x8000000080008008n`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rotl64(x, n) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n = BigInt(n)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ((x \u003c\u003c n) | (x >> (64n - n))) \u0026 0xffffffffffffffffn`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` keccakF(state) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` round = 0; round \u003c KECCAK_ROUNDS; round++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Theta`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` C = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Array(5)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x = 0; x \u003c 5; x++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` C[x] = state[x] ^ state[x + 5] ^ state[x + 10] ^ state[x + 15] ^ state[x + 20]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` D = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Array(5)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x = 0; x \u003c 5; x++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` D[x] = C[(x + 4) % 5] ^ rotl64(C[(x + 1) % 5], 1)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x = 0; x \u003c 5; x++) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y = 0; y \u003c 5; y++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state[x + y * 5] ^= D[x]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Rho and Pi`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` t = state[1]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = 0; i \u003c 24; i++) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` j = PILN[i]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` temp = state[j]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state[j] = rotl64(t, ROTC[i])`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` t = temp`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Chi`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` y = 0; y \u003c 5; y++) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` row = [state[y * 5], state[y * 5 + 1], state[y * 5 + 2], state[y * 5 + 3], state[y * 5 + 4]]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` x = 0; x \u003c 5; x++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state[y * 5 + x] = row[x] ^ ((~row[(x + 1) % 5]) \u0026 row[(x + 2) % 5])`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Iota`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state[0] ^= RNDC[round]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` keccak256(input) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inputBytes = Buffer.isBuffer(input) ? input : Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(input)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rate = 136 `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// (1600 - 256 * 2) / 8 for keccak-256`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Array(25).fill(0n)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Pad the input: append 0x01, then zeros, then 0x80`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` padLen = rate - (inputBytes.length % rate)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` padded = Buffer.alloc(inputBytes.length + padLen)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inputBytes.copy(padded)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` padded[inputBytes.length] = 0x01`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` padded[padded.length - 1] |= 0x80`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Absorb`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` offset = 0; offset \u003c padded.length; offset += rate) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = 0; i \u003c rate / 8; i++) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` lane = padded.readBigUInt64LE(offset + i * 8)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` state[i] ^= lane`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` keccakF(state)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Squeeze (just 32 bytes for keccak-256)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` output = Buffer.alloc(32)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i = 0; i \u003c 4; i++) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` output.writeBigUInt64LE(state[i], i * 8)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` output`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})})]}),_jsx(Step,{title:`Deploy the Function`,children:_jsxs(_components.p,{children:[`Click `,_jsx(_components.strong,{children:`Deploy`}),` to save and deploy your Lambda function`]})}),_jsxs(Step,{title:`Expose Function as HTTP Endpoint`,children:[_jsx(_components.p,{children:`Make the function accessible to your application via an HTTP endpoint.`}),_jsxs(_components.p,{children:[`The simplest approach is to enable a `,_jsx(_components.strong,{children:`Lambda Function URL`}),` — a built-in HTTPS endpoint with no extra infrastructure:`]}),_jsxs(Steps,{children:[_jsx(Step,{title:`Open your Lambda function`,children:_jsxs(_components.p,{children:[`In the AWS Console, navigate to your Lambda function and go to the `,_jsx(_components.strong,{children:`Configuration`}),` tab.`]})}),_jsx(Step,{title:`Create Function URL`,children:_jsxs(_components.p,{children:[`Select `,_jsx(_components.strong,{children:`Function URL`}),` in the left panel, then click `,_jsx(_components.strong,{children:`Create function URL`}),`.`]})}),_jsx(Step,{title:`Set Auth Type`,children:_jsxs(_components.p,{children:[`Choose `,_jsx(_components.strong,{children:`NONE`}),` for auth type (simplest for development). For production, use `,_jsx(_components.strong,{children:`AWS_IAM`}),` and sign requests with SigV4.`]})}),_jsx(Step,{title:`Copy the URL`,children:_jsxs(_components.p,{children:[`Copy the `,_jsx(_components.strong,{children:`Function URL`}),` — you will use this as `,_jsx(_components.code,{children:`KMS_SIGNER_URL`}),` in your application code.`]})})]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`A Function URL with auth type `,_jsx(_components.code,{children:`NONE`}),` is publicly accessible. For production, use `,_jsx(_components.code,{children:`AWS_IAM`}),` auth\nor put the Lambda behind an API Gateway with IAM authorization. See the advanced setup below.`]})}),_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`Advanced: Create an API Gateway with IAM Auth`,id:`advanced-create-an-api-gateway-with-iam-auth`,children:[_jsxs(_components.p,{children:[`For production, you can expose the function via API Gateway with IAM authorization.\nThis requires AWS SigV4-signed requests (e.g., via `,_jsx(_components.code,{children:`awscurl`}),`).`]}),_jsxs(Steps,{children:[_jsx(Step,{title:`Create the API`,children:_jsxs(_components.p,{children:[`Search for “API Gateway” in the AWS Console and click `,_jsx(_components.strong,{children:`Create API`}),`. Select `,_jsx(_components.strong,{children:`Build`}),` for `,_jsx(_components.strong,{children:`REST API`}),`.`]})}),_jsx(Step,{title:`Configure API Settings`,children:_jsxs(_components.p,{children:[`Name your API (e.g., `,_jsx(_components.code,{children:`KMS Sign API`}),`) and select a security policy that meets your requirements.`]})}),_jsxs(Step,{title:`Create a Method`,children:[_jsxs(_components.p,{children:[`After creating the API, select `,_jsx(_components.strong,{children:`Create method`}),` with the following settings:`]}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Setting`}),_jsx(_components.th,{children:`Value`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Method type`}),_jsx(_components.td,{children:`POST`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Lambda function`}),_jsx(_components.td,{children:`Select the Lambda function you created`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Authorization (In Method Request Settings)`}),_jsx(_components.td,{children:`AWS IAM`})]})]})]})]}),_jsx(Step,{title:`Create a Stage`,children:_jsxs(_components.p,{children:[`Go to `,_jsx(_components.strong,{children:`Stages`}),` in the left panel and click `,_jsx(_components.strong,{children:`Create Stage`}),`. Name the stage (e.g., `,_jsx(_components.code,{children:`prod`}),`).`]})}),_jsx(Step,{title:`Deploy the API`,children:_jsxs(_components.p,{children:[`Go back to `,_jsx(_components.strong,{children:`API`}),` > `,_jsx(_components.strong,{children:`Resource`}),` and select `,_jsx(_components.strong,{children:`Deploy API`}),`. Select the stage you created and click `,_jsx(_components.strong,{children:`Deploy`}),`.`]})}),_jsxs(Step,{title:`Add Resource Policy`,children:[_jsxs(_components.p,{children:[`Navigate to `,_jsx(_components.strong,{children:`Resource policy`}),` in the left panel and add the following policy to allow invocations from your AWS account:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`17`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`17`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Version\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2012-10-17\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Statement\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Sid\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"AllowAnyoneInThisAccount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Effect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Allow\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Principal\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"*\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"execute-api:Invoke\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Resource\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"arn:aws:execute-api:REGION:ACCOUNT_ID:API_ID/*/POST/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Condition\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"StringEquals\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"aws:PrincipalAccount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ACCOUNT_ID\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:`Replace the placeholders with your actual values:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Placeholder`}),_jsx(_components.th,{children:`Where to Find It`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`REGION`})}),_jsxs(_components.td,{children:[`Your AWS region (e.g., `,_jsx(_components.code,{children:`us-east-1`}),`, `,_jsx(_components.code,{children:`eu-north-1`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`ACCOUNT_ID`})}),_jsx(_components.td,{children:`Click your profile icon in the top-right corner of AWS Console`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`API_ID`})}),_jsx(_components.td,{children:`Found in the API Gateway console URL or in the API’s ARN`})]})]})]}),_jsxs(_components.p,{children:[`After adding the policy, click `,_jsx(_components.strong,{children:`Save`}),` and then re-deploy the API to the stage for the changes to take effect.`]})]}),_jsx(Step,{title:`Save the Invoke URL`,children:_jsxs(_components.p,{children:[`Copy the `,_jsx(_components.strong,{children:`Invoke URL`}),` for your API. You will need this URL to test the endpoint. You can always find this URL under the `,_jsx(_components.strong,{children:`Stages`}),` view.`]})}),_jsxs(Step,{title:`Grant User Group Access to API Gateway`,children:[_jsx(_components.p,{children:`Add a policy to your user group to allow members to invoke the API Gateway endpoint.`}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Search for `,_jsx(_components.strong,{children:`IAM`}),` in the AWS Console and navigate to `,_jsx(_components.strong,{children:`User groups`}),` in the left panel.`]}),`\n`,_jsx(_components.li,{children:`Select the user group you want to grant access to (or create a new one).`}),`\n`,_jsxs(_components.li,{children:[`Go to the `,_jsx(_components.strong,{children:`Permissions`}),` tab.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Add permissions`}),` and select `,_jsx(_components.strong,{children:`Create inline policy`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Select the `,_jsx(_components.strong,{children:`JSON`}),` tab in the policy editor.`]}),`\n`,_jsx(_components.li,{children:`Paste the following policy:`}),`\n`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Version\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2012-10-17\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Statement\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Effect\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Allow\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"execute-api:Invoke\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"Resource\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"arn:aws:execute-api:REGION:ACCOUNT_ID:API_ID/STAGE/POST/\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:`Replace the placeholders with your actual values:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Placeholder`}),_jsx(_components.th,{children:`Where to Find It`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`REGION`})}),_jsxs(_components.td,{children:[`Your AWS region (e.g., `,_jsx(_components.code,{children:`us-east-1`}),`, `,_jsx(_components.code,{children:`eu-north-1`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`ACCOUNT_ID`})}),_jsx(_components.td,{children:`Click your profile icon in the top-right corner of AWS Console`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`API_ID`})}),_jsx(_components.td,{children:`Found in the API Gateway console URL or in the API’s ARN`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`STAGE`})}),_jsxs(_components.td,{children:[`The stage name you created (e.g., `,_jsx(_components.code,{children:`prod`}),`)`]})]})]})]}),_jsxs(_components.ol,{start:`7`,children:[`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Next`}),`, give the policy a name (e.g., `,_jsx(_components.code,{children:`api-gateway-invoke-policy`}),`), and click `,_jsx(_components.strong,{children:`Create policy`}),`.`]}),`\n`]})]})]})]}),_jsxs(Accordion,{title:`Test Using AWS CLI`,id:`test-using-aws-cli`,children:[_jsx(_components.p,{children:`You can invoke the function using the AWS CLI to ensure everything is working correctly.`}),_jsxs(Steps,{children:[_jsx(Step,{title:`Open Security Credentials`,children:_jsxs(_components.p,{children:[`Click on your username in the top right corner of the AWS Console, then select `,_jsx(_components.strong,{children:`Security credentials`}),` from the dropdown menu.`]})}),_jsx(Step,{title:`Create Access Key`,children:_jsxs(_components.p,{children:[`Scroll down to the `,_jsx(_components.strong,{children:`Access keys`}),` section and click `,_jsx(_components.strong,{children:`Create access key`}),`.`]})}),_jsx(Step,{title:`Select Use Case`,children:_jsxs(_components.p,{children:[`Select the use case (e.g., “Command Line Interface (CLI)”) and click `,_jsx(_components.strong,{children:`Create access key`}),`.`]})}),_jsx(Step,{title:`Copy Access Keys`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important`}),`: Copy both the `,_jsx(_components.strong,{children:`Access key ID`}),` and `,_jsx(_components.strong,{children:`Secret access key`}),` immediately. The secret access key will only be shown once and cannot be retrieved later.`]})}),_jsxs(Step,{title:`Run AWS Configure`,children:[_jsxs(_components.p,{children:[`Run `,_jsx(_components.code,{children:`aws configure`}),` to set up your AWS credentials:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`aws configure`})}),`\n`]})})})]}),_jsx(Step,{title:`Enter Access Key ID`,children:_jsxs(_components.p,{children:[`When prompted, enter your `,_jsx(_components.strong,{children:`AWS Access Key ID`}),`: Paste the access key ID you copied in the previous step.`]})}),_jsx(Step,{title:`Enter Secret Access Key`,children:_jsxs(_components.p,{children:[`Enter your `,_jsx(_components.strong,{children:`AWS Secret Access Key`}),`: Paste the secret access key you copied.`]})}),_jsx(Step,{title:`Enter Default Region`,children:_jsxs(_components.p,{children:[`Enter your `,_jsx(_components.strong,{children:`Default region name`}),`: Enter your AWS region (e.g., `,_jsx(_components.code,{children:`us-east-1`}),`, `,_jsx(_components.code,{children:`eu-north-1`}),`).`]})}),_jsxs(Step,{title:`Set Output Format`,children:[_jsxs(_components.p,{children:[`For `,_jsx(_components.strong,{children:`Default output format`}),`: Press Enter to use the default (JSON) or specify `,_jsx(_components.code,{children:`json`}),`, `,_jsx(_components.code,{children:`yaml`}),`, `,_jsx(_components.code,{children:`text`}),`, or `,_jsx(_components.code,{children:`table`}),`.`]}),_jsxs(_components.p,{children:[`Your credentials will be stored in `,_jsx(_components.code,{children:`~/.aws/credentials`}),` and your configuration in `,_jsx(_components.code,{children:`~/.aws/config`}),`.`]})]}),_jsxs(Step,{title:`Install awscurl`,children:[_jsxs(_components.p,{children:[`Install `,_jsx(_components.code,{children:`awscurl`}),` to make signed requests to your API:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` install awscurl`})]}),`\n`]})})})]}),_jsxs(Step,{title:`Generate Signature`,children:[_jsx(_components.p,{children:`Run the following command to sign a message using your endpoint:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`awscurl --service execute-api --region YOUR_REGION \\\\`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` -X POST `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://YOUR_API_ID.execute-api.YOUR_REGION.amazonaws.com/prod/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` -d `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'{\"digest\":\"BASE64_ENCODED_MESSAGE_HASH\", \"signerAddress\":\"0xYOUR_KMS_SIGNER_ADDRESS\"}'`})]}),`\n`]})})}),_jsx(_components.p,{children:`Replace the placeholders with your actual values:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Placeholder`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`YOUR_REGION`})}),_jsxs(_components.td,{children:[`Your AWS region (e.g., `,_jsx(_components.code,{children:`us-east-1`}),`, `,_jsx(_components.code,{children:`eu-north-1`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`YOUR_API_ID`})}),_jsxs(_components.td,{children:[`Found in the API Gateway console URL or ARN (e.g., if ARN is `,_jsx(_components.code,{children:`arn:aws:execute-api:eu-north-1:257027486036:bho48fe8dl/*/POST/`}),`, then `,_jsx(_components.code,{children:`API_ID`}),` is `,_jsx(_components.code,{children:`bho48fe8dl`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`BASE64_ENCODED_MESSAGE_HASH`})}),_jsx(_components.td,{children:`The base64-encoded message hash returned from wallet APIs`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`0xYOUR_KMS_SIGNER_ADDRESS`})}),_jsx(_components.td,{children:`The Ethereum address derived from your KMS public key (from step 3)`})]})]})]})]})]})]})]})]})]}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`create-and-use-the-crossmint-wallet-2`,children:`Create and Use the Crossmint Wallet`}),_jsx(_components.p,{children:`Now wire everything together — convert your KMS public key to an Ethereum address, create a Crossmint wallet, and sign transactions through your Lambda function.`}),_jsx(Heading,{level:`3`,id:`install-dependencies-2`,children:`Install Dependencies`}),_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`npm`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`yarn`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`yarn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`pnpm`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`bun`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`bun`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add @crossmint/wallets-sdk viem @peculiar/asn1-schema @peculiar/asn1-x509 buffer`})]}),`\n`]})})})]}),_jsx(Heading,{level:`3`,id:`convert-the-kms-public-key-to-an-ethereum-address-2`,children:`Convert the KMS Public Key to an Ethereum Address`}),_jsx(_components.p,{children:`AWS KMS provides the public key in PEM format. You need to convert it to an Ethereum address. The code below\nhandles this conversion by parsing the PEM-encoded public key and deriving the corresponding Ethereum address.`}),_jsx(Info,{children:_jsxs(_components.p,{children:[`Replace the `,_jsx(_components.code,{children:`publicKeyPem`}),` placeholder with the public key you copied from AWS KMS in the previous step.`]})}),_jsx(CodeBlock,{filename:`kms-utils.ts`,numberOfLines:`33`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`33`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { publicKeyToAddress } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"viem/accounts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { AsnParser } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@peculiar/asn1-schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { SubjectPublicKeyInfo } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@peculiar/asn1-x509\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { Buffer } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"buffer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Paste the public key from your AWS KMS key here`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyPem = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`-----BEGIN PUBLIC KEY-----\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`YOUR_KMS_PUBLIC_KEY_HERE`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`-----END PUBLIC KEY-----`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pemToDer(pem: string): Uint8Array {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` b64 = pem`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .replace(/-----BEGIN PUBLIC KEY-----/g, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .replace(/-----END PUBLIC KEY-----/g, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .replace(/\\\\s+/g, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Uint8Array.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(Buffer.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(b64, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base64\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` kmsPemToEthAddress(pem: string): `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` der = pemToDer(pem);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Parse SPKI and extract the BIT STRING (the actual EC point bytes)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` spki = AsnParser.parse(der, SubjectPublicKeyInfo);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` uncompressed = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Uint8Array(spki.subjectPublicKey); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 65 bytes: 04 || X || Y`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (uncompressed.length !== 65 || uncompressed[0] !== 0x04) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Expected uncompressed secp256k1 public key (65 bytes starting with 0x04).\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyHex = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:'`0x${Buffer.from(uncompressed).toString(\"hex\")}`'}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publicKeyToAddress(publicKeyHex);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`@peculiar/asn1-schema`}),` and `,_jsx(_components.code,{children:`@peculiar/asn1-x509`}),` packages were already installed in the “Install Dependencies” step above.`]})}),_jsx(Heading,{level:`3`,id:`build-the-kms-signing-function-2`,children:`Build the KMS Signing Function`}),_jsxs(_components.p,{children:[`The Lambda function from the previous step handles DER-to-Ethereum signature conversion and `,_jsx(`a`,{href:`https://eips.ethereum.org/EIPS/eip-2`,target:`_blank`,children:`EIP-2 low-s normalization`}),`. This client-side function calls your Lambda and returns the resulting signature:`]}),_jsx(Info,{children:_jsxs(_components.p,{children:[`This example uses a plain `,_jsx(_components.code,{children:`fetch`}),` call, which works with Lambda Function URLs (auth type `,_jsx(_components.code,{children:`NONE`}),`). If you set up API Gateway with IAM auth instead, you will need to sign requests with AWS SigV4 — use `,_jsx(_components.code,{children:`awscurl`}),` for testing (see the “Test Using AWS CLI” section above).`]})}),_jsx(CodeBlock,{filename:`kms-signer.ts`,numberOfLines:`23`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` KMS_SIGNER_URL = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://YOUR_LAMBDA_FUNCTION_URL\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`): Promise\u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`> {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` expectedAddress = kmsPemToEthAddress(publicKeyPem);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fetch(KMS_SIGNER_URL, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` method: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` headers: { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body: JSON.stringify({`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hash: message,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signerAddress: expectedAddress,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (!response.ok) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`KMS signing failed: ${response.statusText}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { signature } = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signature `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`create-the-wallet-2`,children:`Create the Wallet`}),_jsx(_components.p,{children:`Use the KMS-derived Ethereum address as the wallet’s recovery method. The recovery method is used for wallet recovery and adding new signers — ideal for a server-held KMS key.`}),_jsx(CodeBlock,{filename:`create-wallet.ts`,numberOfLines:`22`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { CrossmintWallets, createCrossmint } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@crossmint/wallets-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { signWithKms } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-signer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmint = createCrossmint({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` apiKey: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_CROSSMINT_SERVER_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets = CrossmintWallets.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(crossmint);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets.createWallet({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` chain: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base-sepolia\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` recoveryMethods: [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"external-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` address: kmsPemToEthAddress(publicKeyPem),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` onSign: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (message) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` alias: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"my-crossmint-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`use-the-wallet-2`,children:`Use the Wallet`}),_jsx(_components.p,{children:`Once created, retrieve the wallet and use it to sign transactions. Here are a couple of examples:`}),_jsx(CodeBlock,{filename:`use-wallet.ts`,numberOfLines:`28`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`28`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { EVMWallet } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@crossmint/wallets-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { kmsPemToEthAddress, publicKeyPem } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-utils\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { signWithKms } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./kms-signer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { crossmintWallets } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"./create-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` crossmintWallets.getWallet(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"evm:alias:my-crossmint-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { chain: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"base-sepolia\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet.useSigner({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"external-wallet\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` address: kmsPemToEthAddress(publicKeyPem),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` onSign: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (message) => {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` signWithKms(message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `0x${string}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Example: Send tokens`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` wallet.send(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xRecipientAddress\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"usdxm\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Example: Send a raw EVM transaction`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` evmWallet = EVMWallet.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(wallet);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` evmWallet.sendTransaction({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xRecipientAddress\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value: BigInt(0),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(_components.hr,{}),_jsx(Heading,{level:`2`,id:`security-best-practices-2`,children:`Security Best Practices`}),_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Key rotation caveat:`}),` While AWS KMS supports automatic key rotation,\nrotating an asymmetric signing key generates a new key pair — which means a\nnew Ethereum address. For wallets, manage key versions carefully and plan\nmigrations accordingly.`]})}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Restrict Lambda access:`}),` Use IAM authentication or VPC endpoints to ensure only authorized services can call your signing function.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Enable audit logs:`}),` Turn on AWS CloudTrail to log all KMS and Lambda operations.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Principle of least privilege:`}),` Only grant `,_jsx(_components.code,{children:`kms:Sign`}),` and `,_jsx(_components.code,{children:`kms:GetPublicKey`}),` — never grant broader KMS permissions to your signing role.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Environment variables:`}),` Never hardcode your Crossmint API key or AWS credentials. Use environment variables or AWS Secrets Manager.`]}),`\n`]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Cloud KMS Signers","description":"Use a cloud key management service as a secure signer for your Crossmint wallet.","href":"/wallets/guides/signers/cloud-kms"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"How It Works","slug":"how-it-works","depth":2,"children":[],"tabId":"google-cloud-kms"},{"title":"What You Will Build","slug":"what-you-will-build","depth":2,"children":[{"title":"Prerequisites","slug":"prerequisites","depth":3,"children":[],"tabId":"google-cloud-kms"}],"tabId":"google-cloud-kms"},{"title":"Set Up Google Cloud KMS","slug":"set-up-google-cloud-kms","depth":2,"children":[],"tabId":"google-cloud-kms"},{"title":"Set Up IAM Permissions","slug":"set-up-iam-permissions","depth":2,"children":[],"tabId":"google-cloud-kms"},{"title":"Deploy a Cloud Run Signing Function","slug":"deploy-a-cloud-run-signing-function","depth":2,"children":[],"tabId":"google-cloud-kms"},{"title":"Create and Use the Crossmint Wallet","slug":"create-and-use-the-crossmint-wallet","depth":2,"children":[{"title":"Install Dependencies","slug":"install-dependencies","depth":3,"children":[],"tabId":"google-cloud-kms"},{"title":"Convert the KMS Public Key to an Ethereum Address","slug":"convert-the-kms-public-key-to-an-ethereum-address","depth":3,"children":[],"tabId":"google-cloud-kms"},{"title":"Build the KMS Signing Function","slug":"build-the-kms-signing-function","depth":3,"children":[],"tabId":"google-cloud-kms"},{"title":"Create the Wallet","slug":"create-the-wallet","depth":3,"children":[],"tabId":"google-cloud-kms"},{"title":"Use the Wallet","slug":"use-the-wallet","depth":3,"children":[],"tabId":"google-cloud-kms"}],"tabId":"google-cloud-kms"},{"title":"Security Best Practices","slug":"security-best-practices","depth":2,"children":[],"tabId":"google-cloud-kms"},{"title":"How It Works","slug":"how-it-works-2","depth":2,"children":[],"tabId":"aws-kms"},{"title":"What You Will Build","slug":"what-you-will-build-2","depth":2,"children":[{"title":"Prerequisites","slug":"prerequisites-2","depth":3,"children":[],"tabId":"aws-kms"}],"tabId":"aws-kms"},{"title":"Set Up AWS KMS","slug":"set-up-aws-kms","depth":2,"children":[],"tabId":"aws-kms"},{"title":"Set Up IAM Permissions","slug":"set-up-iam-permissions-2","depth":2,"children":[],"tabId":"aws-kms"},{"title":"Deploy a Lambda Signing Function","slug":"deploy-a-lambda-signing-function","depth":2,"children":[],"tabId":"aws-kms"},{"title":"Create and Use the Crossmint Wallet","slug":"create-and-use-the-crossmint-wallet-2","depth":2,"children":[{"title":"Install Dependencies","slug":"install-dependencies-2","depth":3,"children":[],"tabId":"aws-kms"},{"title":"Convert the KMS Public Key to an Ethereum Address","slug":"convert-the-kms-public-key-to-an-ethereum-address-2","depth":3,"children":[],"tabId":"aws-kms"},{"title":"Build the KMS Signing Function","slug":"build-the-kms-signing-function-2","depth":3,"children":[],"tabId":"aws-kms"},{"title":"Create the Wallet","slug":"create-the-wallet-2","depth":3,"children":[],"tabId":"aws-kms"},{"title":"Use the Wallet","slug":"use-the-wallet-2","depth":3,"children":[],"tabId":"aws-kms"}],"tabId":"aws-kms"},{"title":"Security Best Practices","slug":"security-best-practices-2","depth":2,"children":[],"tabId":"aws-kms"}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/crossmint/d1c432d03c0c4224/scripts/dd.js","/_mintlify/custom/crossmint/7fc8d54052d3edb0/scripts/hubspot.js"],"subdomain":"crossmint","siteName":"Crossmint Docs","title":"Cloud KMS Signers - Crossmint Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-06T02:38:49.869Z","originalFileLocation":"wallets/guides/signers/cloud-kms.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use a cloud key management service as a secure signer for your Crossmint wallet.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Crossmint Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Cloud KMS Signers - Crossmint Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Use a cloud key management service as a secure signer for your Crossmint wallet.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Crossmint Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://crossmint.mintlify.site/_mintlify/api/og/v2?division=Setup\u0026amp;title=Cloud+KMS+Signers\u0026amp;description=Use+a+cloud+key+management+service+as+a+secure+signer+for+your+Crossmint+wallet.\u0026amp;theme=b8bba0b38c114479513683ad\u0026amp;signature=c180a1047c43a0ad9c662909ef5bfb3299b63175aa56fe334e91f9566cdd1358\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Cloud KMS Signers - Crossmint Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Use a cloud key management service as a secure signer for your Crossmint wallet.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://crossmint.mintlify.site/_mintlify/api/og/v2?division=Setup\u0026amp;title=Cloud+KMS+Signers\u0026amp;description=Use+a+cloud+key+management+service+as+a+secure+signer+for+your+Crossmint+wallet.\u0026amp;theme=b8bba0b38c114479513683ad\u0026amp;signature=c180a1047c43a0ad9c662909ef5bfb3299b63175aa56fe334e91f9566cdd1358\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/crossmint/-1hhMU0vchFPUD3H/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Crossmint Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#36b37e\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/wallets/guides/signers/cloud-kms.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.crossmint.com/#organization\",\"name\":\"Crossmint Docs\",\"url\":\"https://docs.crossmint.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/crossmint/a8gPOTKEuVFcSfC3/logo/crossmint-light.png?fit=max\u0026auto=format\u0026n=a8gPOTKEuVFcSfC3\u0026q=85\u0026s=8c2671e4c8f7da6956e1508bd68c2928\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.crossmint.com#website\",\"name\":\"Crossmint Docs\",\"url\":\"https://docs.crossmint.com\",\"publisher\":{\"@id\":\"https://docs.crossmint.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms#webpage\",\"url\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms\",\"name\":\"Cloud KMS Signers\",\"description\":\"Use a cloud key management service as a secure signer for your Crossmint wallet.\",\"dateModified\":\"2026-11-06T02:38:49.869Z\",\"isPartOf\":{\"@id\":\"https://docs.crossmint.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.crossmint.com/wallets/guides/create-wallet\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Signers\",\"item\":\"https://docs.crossmint.com/wallets/guides/signers/device-signer\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Setup\",\"item\":\"https://docs.crossmint.com/wallets/guides/signers/device-signer\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Cloud KMS Signers\",\"item\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms#article\",\"headline\":\"Cloud KMS Signers\",\"name\":\"Cloud KMS Signers\",\"description\":\"Use a cloud key management service as a secure signer for your Crossmint wallet.\",\"url\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms\",\"mainEntityOfPage\":{\"@id\":\"https://docs.crossmint.com/wallets/guides/signers/cloud-kms#webpage\"},\"dateModified\":\"2026-11-06T02:38:49.869Z\",\"publisher\":{\"@id\":\"https://docs.crossmint.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.crossmint.com#website\"}}]}\u003c/script>","agentPointerHref":"/wallets/guides/signers/cloud-kms.md","siteName":"Crossmint Docs","nav":{"global":null,"tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/introduction/platform-overview"}]},{"tab":"Wallets","groups":[{"group":"Introduction","pages":[{"title":"Overview","href":"/wallets/overview"}]},{"group":"Quickstarts ⚡","pages":[{"title":"React","href":"/wallets/quickstarts/react"},{"title":"Node.js","href":"/wallets/quickstarts/nodejs"},{"title":"REST API","href":"/wallets/quickstarts/restapi"},{"title":"React Native","href":"/wallets/quickstarts/react-native"},{"title":"Flutter","href":"/wallets/quickstarts/flutter"},{"title":"Swift","href":"/wallets/quickstarts/swift"},{"title":"Kotlin","href":"/wallets/quickstarts/kotlin"}]},{"group":"Concepts","pages":[{"title":"Embedded Wallets","href":"/wallets/concepts/embedded-wallets"},{"title":"Treasury Wallets","href":"/wallets/concepts/treasury"},{"title":"Architecture","href":"/wallets/architecture"},{"title":"Signers","href":"/wallets/concepts/signers"},{"title":"Recovery Methods","href":"/wallets/concepts/recovery"},{"title":"Quorum (multi-approval) Signer","href":"/wallets/concepts/quorum-signers"},{"title":"Custody Models","href":"/wallets/concepts/custody-models"},{"title":"Wallet Locators","href":"/wallets/concepts/wallet-locators"},{"title":"Glossary","href":"/introduction/glossary"}]},{"group":"Guides","pages":[{"group":"Wallet Actions","pages":[{"title":"Create Wallet","href":"/wallets/guides/create-wallet"},{"title":"Fund a Staging Wallet","href":"/wallets/guides/fund-staging-wallet"},{"title":"Check Balances","href":"/wallets/guides/check-balances"},{"title":"Transfer Tokens","href":"/wallets/guides/transfer-tokens"},{"group":"Custom Transactions","pages":[{"title":"Custom EVM Transactions","sidebarTitle":"EVM","href":"/wallets/guides/send-transaction-evm"},{"title":"Custom Solana Transactions","sidebarTitle":"Solana","href":"/wallets/guides/send-transaction-solana"},{"title":"Custom Stellar Transactions","sidebarTitle":"Stellar","href":"/wallets/guides/send-transaction-stellar"}]},{"title":"Sign Messages","sidebarTitle":"Sign Message","href":"/wallets/guides/sign-message"},{"title":"List Wallet Transfers","href":"/wallets/guides/list-transfers"}]},{"group":"Signers","pages":[{"group":"Setup","pages":[{"title":"Device Signer","href":"/wallets/guides/signers/device-signer"},{"title":"Passkey Signer","href":"/wallets/guides/signers/passkey"},{"title":"External Wallet Signer","href":"/wallets/guides/signers/external-wallet"},{"title":"Server Signer","description":"Authorize wallet operations directly from your server, using an API key and secret.","href":"/wallets/guides/signers/server-signer"},{"title":"Cloud KMS Signers","href":"/wallets/guides/signers/cloud-kms"},{"title":"Use a Quorum Signer","description":"Create an m-of-n quorum signer and approve transactions with several members","href":"/wallets/guides/signers/quorum-signer"},{"title":"Server-Side Wallet with Device Signer","href":"/wallets/guides/signers/device-signer-server-wallet"}]},{"group":"Management","pages":[{"title":"Add Signers to a Wallet","href":"/wallets/guides/signers/add-signers"},{"title":"List Wallet Signers","href":"/wallets/guides/signers/list-signers"},{"title":"Restrict a Signer with Scopes","href":"/wallets/guides/signers/scopes"},{"title":"Remove a Signer from a Wallet","href":"/wallets/guides/signers/remove-signer"}]}]},{"group":"Recovery Methods","pages":[{"title":"Configure Wallet Recovery","href":"/wallets/guides/recovery/configure-recovery"},{"title":"Send WhatsApp OTPs From Your Business Number","sidebarTitle":"WhatsApp Sender","href":"/wallets/guides/recovery/whatsapp-sender"},{"title":"Manage Recovery Methods","href":"/wallets/guides/recovery/manage-recovery-methods"},{"title":"Recover a Wallet","href":"/wallets/guides/recovery/wallet-recovery"}]},{"group":"Wallet Extensions","pages":[{"title":"Wallet Extensions","sidebarTitle":"Overview","href":"/wallets/guides/wallet-extensions/overview"},{"group":"Swapping \u0026 Bridging","pages":[{"title":"Swapping \u0026 Bridging Overview","sidebarTitle":"Overview","href":"/wallets/guides/wallet-extensions/swapping-and-bridging"},{"title":"Jupiter","href":"/wallets/guides/wallet-extensions/swap-jupiter"},{"title":"LI.FI","href":"/wallets/guides/wallet-extensions/bridge-lifi"},{"title":"Relay","href":"/wallets/guides/wallet-extensions/relay"}]},{"group":"Yield Generation","pages":[{"title":"Yield.xyz","href":"/wallets/guides/wallet-extensions/yield-xyz"},{"title":"Morpho","href":"/wallets/guides/wallet-extensions/morpho"}]},{"group":"Card Issuance","pages":[{"title":"Rain Card Issuance","sidebarTitle":"Rain","href":"/wallets/guides/wallet-extensions/credit-cards"},{"title":"Reap Card Issuance","sidebarTitle":"Reap","href":"/wallets/guides/wallet-extensions/reap"}]},{"title":"Embedded Credit","href":"/wallets/guides/wallet-extensions/tala"},{"group":"Tokenized Stocks","pages":[{"title":"Ondo Global Markets","href":"/wallets/guides/wallet-extensions/swap-ondo"}]}]},{"group":"Advanced","pages":[{"title":"Use Your Own Auth Provider","href":"/wallets/guides/bring-your-own-auth"},{"title":"Sponsor Gas Fees","href":"/wallets/guides/gas-sponsorship"},{"title":"Wallet Webhooks","href":"/wallets/guides/webhooks"},{"title":"Set Up a Treasury Wallet","href":"/wallets/guides/treasury-wallets"},{"title":"Export Private Key","href":"/wallets/guides/export-private-key"},{"title":"Troubleshooting","href":"/wallets/guides/troubleshooting"},{"title":"Migrate to V1","href":"/wallets/guides/migrate-to-v1"},{"title":"Migrate to React Native SDK 2.0","href":"/wallets/guides/migrate-react-native-sdk-2"}]}]},{"group":"API Reference","pages":[{"group":"REST","icon":"brackets-curly","pages":[{"title":"Introduction","href":"/api-reference/introduction"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets","title":"Create Wallet","href":"/api-reference/wallets/create-wallet"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}","title":"Get Wallet By Locator","href":"/api-reference/wallets/get-wallet-by-locator"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/balances","title":"Get Wallet Balance","href":"/api-reference/wallets/get-wallet-balance"},{"openapi":"api-reference/_open-api/Wallets.json POST /v1-alpha2/wallets/{walletLocator}/balances","title":"Fund Wallet","href":"/api-reference/wallets/fund-wallet"},{"openapi":"api-reference/_open-api/Wallets.json GET /2022-06-09/wallets/{locator}/nfts","title":"Get NFTs from Wallet","href":"/api-reference/wallets/get-nfts-from-wallet"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/transactions","title":"Create Transaction","href":"/api-reference/wallets/create-transaction"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/transactions/{transactionId}","title":"Get Transaction","href":"/api-reference/wallets/get-transaction"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/transactions","title":"Get Wallet Transactions","href":"/api-reference/wallets/get-transactions"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals","title":"Approve Transaction","href":"/api-reference/wallets/approve-transaction"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/signatures","title":"Create Signature","href":"/api-reference/wallets/create-signature"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/signatures","title":"Get All Signatures","href":"/api-reference/wallets/get-signatures"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/signatures/{signatureId}","title":"Get Signature","href":"/api-reference/wallets/get-signature"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals","title":"Approve Signature","href":"/api-reference/wallets/approve-signature"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/signers","title":"Create Delegated Signer","href":"/api-reference/wallets/register-delegated-key"},{"openapi":"api-reference/_open-api/Wallets.json DELETE /2025-06-09/wallets/{walletLocator}/signers/{signer}","title":"Remove Delegated Signer","href":"/api-reference/wallets/remove-delegated-key"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/signers/{signer}","title":"Get Delegated Signer","href":"/api-reference/wallets/get-signer"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/recovery-methods","title":"Add Recovery Method","href":"/api-reference/wallets/add-recovery-method"},{"openapi":"api-reference/_open-api/Wallets.json DELETE /2025-06-09/wallets/{walletLocator}/recovery-methods/{signer}","title":"Remove Recovery Method","href":"/api-reference/wallets/remove-recovery-method"},{"openapi":"api-reference/_open-api/Wallets.json POST /2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers","title":"Transfer Token","href":"/api-reference/wallets/transfer-token"},{"openapi":"api-reference/_open-api/Wallets.json GET /2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}","title":"Get Transfer Transaction","href":"/api-reference/wallets/get-transfer-token"},{"title":"List Wallet Transfers","openapi":"api-reference/_open-api/Wallets.json GET /unstable/wallets/{walletLocator}/transfers","href":"/api-reference/wallets/list-transfers"}]},{"group":"Typescript SDK","icon":"/images/icons/ts-logo-128.png","pages":[{"title":"Getting Started","href":"/sdk-reference/wallets/typescript/overview"},{"title":"Reference","href":"/sdk-reference/wallets/typescript/reference"},{"group":"Classes","pages":[{"title":"AuthRejectedError","href":"/sdk-reference/wallets/typescript/classes/AuthRejectedError"},{"title":"CrossmintWallets","href":"/sdk-reference/wallets/typescript/classes/CrossmintWallets"},{"title":"DeviceSignerKeyStorage","href":"/sdk-reference/wallets/typescript/classes/DeviceSignerKeyStorage"},{"title":"DuplicateRecoverySignerError","href":"/sdk-reference/wallets/typescript/classes/DuplicateRecoverySignerError"},{"title":"EVMWallet","href":"/sdk-reference/wallets/typescript/classes/EVMWallet"},{"title":"IframeDeviceSignerKeyStorage","href":"/sdk-reference/wallets/typescript/classes/IframeDeviceSignerKeyStorage"},{"title":"InvalidRecoveryConfigError","href":"/sdk-reference/wallets/typescript/classes/InvalidRecoveryConfigError"},{"title":"InvalidTransferAmountError","href":"/sdk-reference/wallets/typescript/classes/InvalidTransferAmountError"},{"title":"JWTDecryptionError","href":"/sdk-reference/wallets/typescript/classes/JWTDecryptionError"},{"title":"JWTExpiredError","href":"/sdk-reference/wallets/typescript/classes/JWTExpiredError"},{"title":"JWTIdentifierError","href":"/sdk-reference/wallets/typescript/classes/JWTIdentifierError"},{"title":"JWTInvalidError","href":"/sdk-reference/wallets/typescript/classes/JWTInvalidError"},{"title":"KeyExportError","href":"/sdk-reference/wallets/typescript/classes/KeyExportError"},{"title":"NotAuthorizedError","href":"/sdk-reference/wallets/typescript/classes/NotAuthorizedError"},{"title":"NotSupportedOnApiVersionError","href":"/sdk-reference/wallets/typescript/classes/NotSupportedOnApiVersionError"},{"title":"OnboardingSessionExpiredError","href":"/sdk-reference/wallets/typescript/classes/OnboardingSessionExpiredError"},{"title":"OtpValidationError","href":"/sdk-reference/wallets/typescript/classes/OtpValidationError"},{"title":"QuorumSignerNotSupportedError","href":"/sdk-reference/wallets/typescript/classes/QuorumSignerNotSupportedError"},{"title":"RecoveryAdminSignerConflictError","href":"/sdk-reference/wallets/typescript/classes/RecoveryAdminSignerConflictError"},{"title":"RecoveryMethodRequiredError","href":"/sdk-reference/wallets/typescript/classes/RecoveryMethodRequiredError"},{"title":"RecoveryNotSupportedOnChainError","href":"/sdk-reference/wallets/typescript/classes/RecoveryNotSupportedOnChainError"},{"title":"RecoverySignerConflictError","href":"/sdk-reference/wallets/typescript/classes/RecoverySignerConflictError"},{"title":"RecoverySignerLimitExceededError","href":"/sdk-reference/wallets/typescript/classes/RecoverySignerLimitExceededError"},{"title":"SignerAuthenticationError","href":"/sdk-reference/wallets/typescript/classes/SignerAuthenticationError"},{"title":"SignerLimitExceededError","href":"/sdk-reference/wallets/typescript/classes/SignerLimitExceededError"},{"title":"SignerRequiredError","href":"/sdk-reference/wallets/typescript/classes/SignerRequiredError"},{"title":"SignerStatusError","href":"/sdk-reference/wallets/typescript/classes/SignerStatusError"},{"title":"SolanaWallet","href":"/sdk-reference/wallets/typescript/classes/SolanaWallet"},{"title":"StellarWallet","href":"/sdk-reference/wallets/typescript/classes/StellarWallet"},{"title":"TransactionNotCreatedError","href":"/sdk-reference/wallets/typescript/classes/TransactionNotCreatedError"},{"title":"UnsupportedBrowserError","href":"/sdk-reference/wallets/typescript/classes/UnsupportedBrowserError"},{"title":"Wallet","href":"/sdk-reference/wallets/typescript/classes/Wallet"},{"title":"WalletNotAvailableError","href":"/sdk-reference/wallets/typescript/classes/WalletNotAvailableError"},{"title":"WalletsApiClient","href":"/sdk-reference/wallets/typescript/classes/WalletsApiClient"}]},{"group":"Interfaces","pages":[{"title":"ExportableSignerAdapter","href":"/sdk-reference/wallets/typescript/interfaces/ExportableSignerAdapter"},{"title":"SignerAdapter","href":"/sdk-reference/wallets/typescript/interfaces/SignerAdapter"}]},{"group":"Type Aliases","pages":[{"title":"AddRecoveryMethodOptions","href":"/sdk-reference/wallets/typescript/type-aliases/AddRecoveryMethodOptions"},{"title":"AddRecoveryMethodReturnType","href":"/sdk-reference/wallets/typescript/type-aliases/AddRecoveryMethodReturnType"},{"title":"AddSignerOptions","href":"/sdk-reference/wallets/typescript/type-aliases/AddSignerOptions"},{"title":"ApiKeySignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/ApiKeySignerLocator"},{"title":"ApproveOptions","href":"/sdk-reference/wallets/typescript/type-aliases/ApproveOptions"},{"title":"ApproveParams","href":"/sdk-reference/wallets/typescript/type-aliases/ApproveParams"},{"title":"ApproveTransactionParams","href":"/sdk-reference/wallets/typescript/type-aliases/ApproveTransactionParams"},{"title":"Balances","href":"/sdk-reference/wallets/typescript/type-aliases/Balances"},{"title":"BiometricRequestHandler","href":"/sdk-reference/wallets/typescript/type-aliases/BiometricRequestHandler"},{"title":"Callbacks","href":"/sdk-reference/wallets/typescript/type-aliases/Callbacks"},{"title":"Chain","href":"/sdk-reference/wallets/typescript/type-aliases/Chain"},{"title":"ClientSideWalletArgsFor","href":"/sdk-reference/wallets/typescript/type-aliases/ClientSideWalletArgsFor"},{"title":"ClientSideWalletCreateArgs","href":"/sdk-reference/wallets/typescript/type-aliases/ClientSideWalletCreateArgs"},{"title":"CreateServerSignerParams","href":"/sdk-reference/wallets/typescript/type-aliases/CreateServerSignerParams"},{"title":"CreateWalletParams","href":"/sdk-reference/wallets/typescript/type-aliases/CreateWalletParams"},{"title":"CreateWalletResponse","href":"/sdk-reference/wallets/typescript/type-aliases/CreateWalletResponse"},{"title":"DeviceSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/DeviceSignerConfig"},{"title":"DeviceSignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/DeviceSignerLocator"},{"title":"EVMChain","href":"/sdk-reference/wallets/typescript/type-aliases/EVMChain"},{"title":"EVMTransactionInput","href":"/sdk-reference/wallets/typescript/type-aliases/EVMTransactionInput"},{"title":"EmailSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/EmailSignerConfig"},{"title":"EmailSignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/EmailSignerLocator"},{"title":"EvmExternalWalletSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/EvmExternalWalletSignerConfig"},{"title":"ExportSignerTEEConnection","href":"/sdk-reference/wallets/typescript/type-aliases/ExportSignerTEEConnection"},{"title":"ExternalWalletRegistrationConfig","href":"/sdk-reference/wallets/typescript/type-aliases/ExternalWalletRegistrationConfig"},{"title":"ExternalWalletSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/ExternalWalletSignerConfig"},{"title":"ExternalWalletSignerConfigForChain","href":"/sdk-reference/wallets/typescript/type-aliases/ExternalWalletSignerConfigForChain"},{"title":"ExternalWalletSignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/ExternalWalletSignerLocator"},{"title":"FundWalletParams","href":"/sdk-reference/wallets/typescript/type-aliases/FundWalletParams"},{"title":"FundWalletResponse","href":"/sdk-reference/wallets/typescript/type-aliases/FundWalletResponse"},{"title":"GetBalanceResponse","href":"/sdk-reference/wallets/typescript/type-aliases/GetBalanceResponse"},{"title":"GetTransactionResponse","href":"/sdk-reference/wallets/typescript/type-aliases/GetTransactionResponse"},{"title":"PasskeyProvider","href":"/sdk-reference/wallets/typescript/type-aliases/PasskeyProvider"},{"title":"PasskeySignResult","href":"/sdk-reference/wallets/typescript/type-aliases/PasskeySignResult"},{"title":"PasskeySignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/PasskeySignerLocator"},{"title":"PhoneSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/PhoneSignerConfig"},{"title":"PhoneSignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/PhoneSignerLocator"},{"title":"RecoverySignerConfigForChain","href":"/sdk-reference/wallets/typescript/type-aliases/RecoverySignerConfigForChain"},{"title":"RegisterSignerPasskeyParams","href":"/sdk-reference/wallets/typescript/type-aliases/RegisterSignerPasskeyParams"},{"title":"RemoveRecoveryMethodOptions","href":"/sdk-reference/wallets/typescript/type-aliases/RemoveRecoveryMethodOptions"},{"title":"RemoveRecoveryMethodReturnType","href":"/sdk-reference/wallets/typescript/type-aliases/RemoveRecoveryMethodReturnType"},{"title":"RemoveSignerOptions","href":"/sdk-reference/wallets/typescript/type-aliases/RemoveSignerOptions"},{"title":"Scope","href":"/sdk-reference/wallets/typescript/type-aliases/Scope"},{"title":"SendResponse","href":"/sdk-reference/wallets/typescript/type-aliases/SendResponse"},{"title":"ServerSigner","href":"/sdk-reference/wallets/typescript/type-aliases/ServerSigner"},{"title":"ServerSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/ServerSignerConfig"},{"title":"Signature","href":"/sdk-reference/wallets/typescript/type-aliases/Signature"},{"title":"Signer","href":"/sdk-reference/wallets/typescript/type-aliases/Signer"},{"title":"SignerConfigForChain","href":"/sdk-reference/wallets/typescript/type-aliases/SignerConfigForChain"},{"title":"SignerLocator","href":"/sdk-reference/wallets/typescript/type-aliases/SignerLocator"},{"title":"SignerStatus","href":"/sdk-reference/wallets/typescript/type-aliases/SignerStatus"},{"title":"SolanaChain","href":"/sdk-reference/wallets/typescript/type-aliases/SolanaChain"},{"title":"SolanaExternalWalletSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/SolanaExternalWalletSignerConfig"},{"title":"SolanaTransactionInput","href":"/sdk-reference/wallets/typescript/type-aliases/SolanaTransactionInput"},{"title":"StellarChain","href":"/sdk-reference/wallets/typescript/type-aliases/StellarChain"},{"title":"StellarExternalWalletSignerConfig","href":"/sdk-reference/wallets/typescript/type-aliases/StellarExternalWalletSignerConfig"},{"title":"Transaction","href":"/sdk-reference/wallets/typescript/type-aliases/Transaction"},{"title":"TransferScope","href":"/sdk-reference/wallets/typescript/type-aliases/TransferScope"},{"title":"Transfers","href":"/sdk-reference/wallets/typescript/type-aliases/Transfers"},{"title":"WalletArgsFor","href":"/sdk-reference/wallets/typescript/type-aliases/WalletArgsFor"},{"title":"WalletCreateArgs","href":"/sdk-reference/wallets/typescript/type-aliases/WalletCreateArgs"},{"title":"WalletLocator","href":"/sdk-reference/wallets/typescript/type-aliases/WalletLocator"},{"title":"WalletOptions","href":"/sdk-reference/wallets/typescript/type-aliases/WalletOptions"},{"title":"WalletPlugin","href":"/sdk-reference/wallets/typescript/type-aliases/WalletPlugin"}]},{"group":"Functions","pages":[{"title":"createCrossmint","href":"/sdk-reference/wallets/typescript/functions/createCrossmint"},{"title":"createDeviceSigner","href":"/sdk-reference/wallets/typescript/functions/createDeviceSigner"},{"title":"createServerSigner","href":"/sdk-reference/wallets/typescript/functions/createServerSigner"},{"title":"isExportableSignerAdapter","href":"/sdk-reference/wallets/typescript/functions/isExportableSignerAdapter"},{"title":"recoveryMethodsFromCreateArgs","href":"/sdk-reference/wallets/typescript/functions/recoveryMethodsFromCreateArgs"}]}]},{"group":"React SDK","icon":"/images/icons/react.svg","pages":[{"title":"Get Started","href":"/sdk-reference/wallets/react/get-started"},{"title":"Providers","href":"/sdk-reference/wallets/react/providers"},{"title":"Hooks","href":"/sdk-reference/wallets/react/hooks"},{"title":"Components","href":"/sdk-reference/wallets/react/components"}]},{"group":"React Native SDK","icon":"/images/icons/react-native.svg","pages":[{"title":"Get Started","href":"/sdk-reference/wallets/react-native/get-started"},{"title":"Providers","href":"/sdk-reference/wallets/react-native/providers"},{"title":"Hooks","href":"/sdk-reference/wallets/react-native/hooks"},{"title":"Components","href":"/sdk-reference/wallets/react-native/components"}]},{"group":"Flutter SDK","icon":"/images/icons/flutter.svg","pages":[{"title":"Get Started","href":"/sdk-reference/wallets/flutter/get-started"},{"title":"Providers","href":"/sdk-reference/wallets/flutter/providers"},{"title":"Controllers","href":"/sdk-reference/wallets/flutter/controllers"},{"title":"Widgets","href":"/sdk-reference/wallets/flutter/widgets"},{"group":"Classes","pages":[{"title":"ChainExplorerRegistry","href":"/sdk-reference/wallets/flutter/classes/chain-explorer-registry"},{"title":"CrossmintApiConfig","href":"/sdk-reference/wallets/flutter/classes/crossmint-api-config"},{"title":"CrossmintApiKeySigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-api-key-signer"},{"title":"CrossmintApiVersions","href":"/sdk-reference/wallets/flutter/classes/crossmint-api-versions"},{"title":"CrossmintAuthClient","href":"/sdk-reference/wallets/flutter/classes/crossmint-auth-client"},{"title":"CrossmintAuthException","href":"/sdk-reference/wallets/flutter/classes/crossmint-auth-exception"},{"title":"CrossmintAuthRejectedException","href":"/sdk-reference/wallets/flutter/classes/crossmint-auth-rejected-exception"},{"title":"CrossmintAuthScope","href":"/sdk-reference/wallets/flutter/classes/crossmint-auth-scope"},{"title":"CrossmintClient","href":"/sdk-reference/wallets/flutter/classes/crossmint-client"},{"title":"CrossmintClientConfig","href":"/sdk-reference/wallets/flutter/classes/crossmint-client-config"},{"title":"CrossmintConfigurationException","href":"/sdk-reference/wallets/flutter/classes/crossmint-configuration-exception"},{"title":"CrossmintCredentialsException","href":"/sdk-reference/wallets/flutter/classes/crossmint-credentials-exception"},{"title":"CrossmintDeserializationException","href":"/sdk-reference/wallets/flutter/classes/crossmint-deserialization-exception"},{"title":"CrossmintDeviceWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-device-wallet-signer"},{"title":"CrossmintEmailOtpDialog","href":"/sdk-reference/wallets/flutter/classes/crossmint-email-otp-dialog"},{"title":"CrossmintEvmExternalWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-evm-external-wallet-signer"},{"title":"CrossmintEvmNonCustodialSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-evm-non-custodial-signer"},{"title":"CrossmintEvmWallet","href":"/sdk-reference/wallets/flutter/classes/crossmint-evm-wallet"},{"title":"CrossmintException","href":"/sdk-reference/wallets/flutter/classes/crossmint-exception"},{"title":"CrossmintExportPrivateKeyButton","href":"/sdk-reference/wallets/flutter/classes/crossmint-export-private-key-button"},{"title":"CrossmintExportableWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-exportable-wallet-signer"},{"title":"CrossmintExternalWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-external-wallet-signer"},{"title":"CrossmintNonCustodialSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-non-custodial-signer"},{"title":"CrossmintOtpCodeInputStep","href":"/sdk-reference/wallets/flutter/classes/crossmint-otp-code-input-step"},{"title":"CrossmintOtpConfirmationStep","href":"/sdk-reference/wallets/flutter/classes/crossmint-otp-confirmation-step"},{"title":"CrossmintOtpModalShell","href":"/sdk-reference/wallets/flutter/classes/crossmint-otp-modal-shell"},{"title":"CrossmintPasskeyApprovalSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-passkey-approval-signer"},{"title":"CrossmintPasskeySignerFactory","href":"/sdk-reference/wallets/flutter/classes/crossmint-passkey-signer-factory"},{"title":"CrossmintPhoneOtpDialog","href":"/sdk-reference/wallets/flutter/classes/crossmint-phone-otp-dialog"},{"title":"CrossmintPollingConfig","href":"/sdk-reference/wallets/flutter/classes/crossmint-polling-config"},{"title":"CrossmintRuntimeWalletBase","href":"/sdk-reference/wallets/flutter/classes/crossmint-runtime-wallet-base"},{"title":"CrossmintSignerException","href":"/sdk-reference/wallets/flutter/classes/crossmint-signer-exception"},{"title":"CrossmintSolanaExternalWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-solana-external-wallet-signer"},{"title":"CrossmintSolanaNonCustodialSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-solana-non-custodial-signer"},{"title":"CrossmintSolanaWallet","href":"/sdk-reference/wallets/flutter/classes/crossmint-solana-wallet"},{"title":"CrossmintStellarExternalWalletSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-stellar-external-wallet-signer"},{"title":"CrossmintStellarNonCustodialSigner","href":"/sdk-reference/wallets/flutter/classes/crossmint-stellar-non-custodial-signer"},{"title":"CrossmintStellarWallet","href":"/sdk-reference/wallets/flutter/classes/crossmint-stellar-wallet"},{"title":"CrossmintTokensException","href":"/sdk-reference/wallets/flutter/classes/crossmint-tokens-exception"},{"title":"CrossmintUsersException","href":"/sdk-reference/wallets/flutter/classes/crossmint-users-exception"},{"title":"CrossmintWalletAuthChallenge","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-auth-challenge"},{"title":"CrossmintWalletController","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-controller"},{"title":"CrossmintWalletControllerConfig","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-controller-config"},{"title":"CrossmintWalletException","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-exception"},{"title":"CrossmintWalletHost","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-host"},{"title":"CrossmintWalletLifecycleCallbacks","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-lifecycle-callbacks"},{"title":"CrossmintWalletOtpController","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-otp-controller"},{"title":"CrossmintWalletProvider","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-provider"},{"title":"CrossmintWalletProviderConfig","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-provider-config"},{"title":"CrossmintWalletProviderDependencies","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-provider-dependencies"},{"title":"CrossmintWalletScope","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-scope"},{"title":"CrossmintWalletStateRepository","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-state-repository"},{"title":"CrossmintWalletStateView","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallet-state-view"},{"title":"CrossmintWallets","href":"/sdk-reference/wallets/flutter/classes/crossmint-wallets"},{"title":"DefaultCrossmintAppIdentityResolver","href":"/sdk-reference/wallets/flutter/classes/default-crossmint-app-identity-resolver"},{"title":"SoftwareDeviceSignerKeyStorage","href":"/sdk-reference/wallets/flutter/classes/software-device-signer-key-storage"},{"title":"UnsupportedPasskeySignerFactory","href":"/sdk-reference/wallets/flutter/classes/unsupported-passkey-signer-factory"},{"title":"WalletResponseParser","href":"/sdk-reference/wallets/flutter/classes/wallet-response-parser"},{"title":"WalletSerializationCodec","href":"/sdk-reference/wallets/flutter/classes/wallet-serialization-codec"}]},{"group":"Enums","pages":[{"title":"CrossmintChain","href":"/sdk-reference/wallets/flutter/enums/crossmint-chain"},{"title":"CrossmintChainFamily","href":"/sdk-reference/wallets/flutter/enums/crossmint-chain-family"},{"title":"CrossmintErrorCode","href":"/sdk-reference/wallets/flutter/enums/crossmint-error-code"},{"title":"CrossmintOtpDeliveryChannel","href":"/sdk-reference/wallets/flutter/enums/crossmint-otp-delivery-channel"},{"title":"CrossmintWalletStatus","href":"/sdk-reference/wallets/flutter/enums/crossmint-wallet-status"}]},{"group":"Type Aliases","pages":[{"title":"CrossmintExportPrivateKeyButtonBuilder","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-export-private-key-button-builder"},{"title":"CrossmintExternalWalletSignCallback","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-external-wallet-sign-callback"},{"title":"CrossmintOtpPromptBuilder","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-otp-prompt-builder"},{"title":"CrossmintOtpRejectCallback","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-otp-reject-callback"},{"title":"CrossmintOtpSendCallback","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-otp-send-callback"},{"title":"CrossmintOtpVerifyCallback","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-otp-verify-callback"},{"title":"CrossmintSignerAuthRequiredCallback","href":"/sdk-reference/wallets/flutter/type-aliases/crossmint-signer-auth-required-callback"}]}]},{"group":"Swift SDK","icon":"/images/icons/swift.svg","pages":[{"group":"Classes","pages":[{"title":"ABI","href":"/sdk-reference/wallets/swift/classes/abi"},{"title":"ApiKeySigner","href":"/sdk-reference/wallets/swift/classes/apikeysigner"},{"title":"CrossmintAuthManager","href":"/sdk-reference/wallets/swift/classes/crossmintauthmanager"},{"title":"CrossmintSDK","href":"/sdk-reference/wallets/swift/classes/crossmintsdk"},{"title":"DefaultAuthClient","href":"/sdk-reference/wallets/swift/classes/defaultauthclient"},{"title":"DefaultAuthService","href":"/sdk-reference/wallets/swift/classes/defaultauthservice"},{"title":"DefaultCrossmintWallets","href":"/sdk-reference/wallets/swift/classes/defaultcrossmintwallets"},{"title":"DefaultSmartWalletService","href":"/sdk-reference/wallets/swift/classes/defaultsmartwalletservice"},{"title":"EVMEmailSigner","href":"/sdk-reference/wallets/swift/classes/evmemailsigner"},{"title":"EVMKeyPairSigner","href":"/sdk-reference/wallets/swift/classes/evmkeypairsigner"},{"title":"EVMWallet","href":"/sdk-reference/wallets/swift/classes/evmwallet"},{"title":"PasskeySigner","href":"/sdk-reference/wallets/swift/classes/passkeysigner"},{"title":"PhoneSigner","href":"/sdk-reference/wallets/swift/classes/phonesigner"},{"title":"SolanaEmailSigner","href":"/sdk-reference/wallets/swift/classes/solanaemailsigner"},{"title":"SolanaWallet","href":"/sdk-reference/wallets/swift/classes/solanawallet"},{"title":"StellarEmailSigner","href":"/sdk-reference/wallets/swift/classes/stellaremailsigner"},{"title":"StellarWallet","href":"/sdk-reference/wallets/swift/classes/stellarwallet"},{"title":"Wallet","href":"/sdk-reference/wallets/swift/classes/wallet"}]},{"group":"Protocols","pages":[{"title":"AdminSignerApiModel","href":"/sdk-reference/wallets/swift/protocols/adminsignerapimodel"},{"title":"AdminSignerData","href":"/sdk-reference/wallets/swift/protocols/adminsignerdata"},{"title":"AnyChain","href":"/sdk-reference/wallets/swift/protocols/anychain"},{"title":"ApprovalSigner","href":"/sdk-reference/wallets/swift/protocols/approvalsigner"},{"title":"AuthClient","href":"/sdk-reference/wallets/swift/protocols/authclient"},{"title":"AuthManager","href":"/sdk-reference/wallets/swift/protocols/authmanager"},{"title":"AuthService","href":"/sdk-reference/wallets/swift/protocols/authservice"},{"title":"BalanceService","href":"/sdk-reference/wallets/swift/protocols/balanceservice"},{"title":"BlockchainAddress","href":"/sdk-reference/wallets/swift/protocols/blockchainaddress"},{"title":"ChainWithSigners","href":"/sdk-reference/wallets/swift/protocols/chainwithsigners"},{"title":"CrossmintWallets","href":"/sdk-reference/wallets/swift/protocols/crossmintwallets"},{"title":"EVMCompatibleSigner","href":"/sdk-reference/wallets/swift/protocols/evmcompatiblesigner"},{"title":"NFTService","href":"/sdk-reference/wallets/swift/protocols/nftservice"},{"title":"SignatureApiModel","href":"/sdk-reference/wallets/swift/protocols/signatureapimodel"},{"title":"SignatureService","href":"/sdk-reference/wallets/swift/protocols/signatureservice"},{"title":"Signer","href":"/sdk-reference/wallets/swift/protocols/signer"},{"title":"SignerProvider","href":"/sdk-reference/wallets/swift/protocols/signerprovider"},{"title":"SmartWalletCreationQueryParams","href":"/sdk-reference/wallets/swift/protocols/smartwalletcreationqueryparams"},{"title":"SmartWalletService","href":"/sdk-reference/wallets/swift/protocols/smartwalletservice"},{"title":"SolanaCompatibleSigner","href":"/sdk-reference/wallets/swift/protocols/solanacompatiblesigner"},{"title":"SpecificChain","href":"/sdk-reference/wallets/swift/protocols/specificchain"},{"title":"StellarCompatibleSigner","href":"/sdk-reference/wallets/swift/protocols/stellarcompatiblesigner"},{"title":"TransactionApiModel","href":"/sdk-reference/wallets/swift/protocols/transactionapimodel"},{"title":"TransactionRequest","href":"/sdk-reference/wallets/swift/protocols/transactionrequest"},{"title":"TransactionService","href":"/sdk-reference/wallets/swift/protocols/transactionservice"},{"title":"TransferService","href":"/sdk-reference/wallets/swift/protocols/transferservice"},{"title":"WalletOnChain","href":"/sdk-reference/wallets/swift/protocols/walletonchain"},{"title":"WalletService","href":"/sdk-reference/wallets/swift/protocols/walletservice"},{"title":"WalletTypeTransactionMapping","href":"/sdk-reference/wallets/swift/protocols/wallettypetransactionmapping"}]},{"group":"Enums","pages":[{"title":"Address","href":"/sdk-reference/wallets/swift/enums/address"},{"title":"AdminSignerDataType","href":"/sdk-reference/wallets/swift/enums/adminsignerdatatype"},{"title":"AuthenticationStatus","href":"/sdk-reference/wallets/swift/enums/authenticationstatus"},{"title":"AuthError","href":"/sdk-reference/wallets/swift/enums/autherror"},{"title":"AuthManagerError","href":"/sdk-reference/wallets/swift/enums/authmanagererror"},{"title":"BlockchainAddressError","href":"/sdk-reference/wallets/swift/enums/blockchainaddresserror"},{"title":"BlockchainExplorerLinkType","href":"/sdk-reference/wallets/swift/enums/blockchainexplorerlinktype"},{"title":"Chain","href":"/sdk-reference/wallets/swift/enums/chain"},{"title":"ChainAndAddress","href":"/sdk-reference/wallets/swift/enums/chainandaddress"},{"title":"ChainType","href":"/sdk-reference/wallets/swift/enums/chaintype"},{"title":"CryptoCurrency","href":"/sdk-reference/wallets/swift/enums/cryptocurrency"},{"title":"CryptoPaymentFailureCode","href":"/sdk-reference/wallets/swift/enums/cryptopaymentfailurecode"},{"title":"EIP712","href":"/sdk-reference/wallets/swift/enums/eip712"},{"title":"EVMChain","href":"/sdk-reference/wallets/swift/enums/evmchain"},{"title":"EVMSigners","href":"/sdk-reference/wallets/swift/enums/evmsigners"},{"title":"EVMSmartWalletMapping","href":"/sdk-reference/wallets/swift/enums/evmsmartwalletmapping"},{"title":"FiatCurrency","href":"/sdk-reference/wallets/swift/enums/fiatcurrency"},{"title":"LinkedUserError","href":"/sdk-reference/wallets/swift/enums/linkedusererror"},{"title":"NonCustodialSignerError","href":"/sdk-reference/wallets/swift/enums/noncustodialsignererror"},{"title":"OTPAuthenticationStatus","href":"/sdk-reference/wallets/swift/enums/otpauthenticationstatus"},{"title":"OTPDeliveryChannel","href":"/sdk-reference/wallets/swift/enums/otpdeliverychannel"},{"title":"Owner","href":"/sdk-reference/wallets/swift/enums/owner"},{"title":"SignatureError","href":"/sdk-reference/wallets/swift/enums/signatureerror"},{"title":"SignerConfig","href":"/sdk-reference/wallets/swift/enums/signerconfig"},{"title":"SignerError","href":"/sdk-reference/wallets/swift/enums/signererror"},{"title":"SignerLocator","href":"/sdk-reference/wallets/swift/enums/signerlocator"},{"title":"Signers","href":"/sdk-reference/wallets/swift/enums/signers"},{"title":"SignerStatus","href":"/sdk-reference/wallets/swift/enums/signerstatus"},{"title":"SignerType","href":"/sdk-reference/wallets/swift/enums/signertype"},{"title":"SolanaChain","href":"/sdk-reference/wallets/swift/enums/solanachain"},{"title":"SolanaSigners","href":"/sdk-reference/wallets/swift/enums/solanasigners"},{"title":"SolanaSmartWalletMapping","href":"/sdk-reference/wallets/swift/enums/solanasmartwalletmapping"},{"title":"SolanaSupportedToken","href":"/sdk-reference/wallets/swift/enums/solanasupportedtoken"},{"title":"StellarChain","href":"/sdk-reference/wallets/swift/enums/stellarchain"},{"title":"StellarSigners","href":"/sdk-reference/wallets/swift/enums/stellarsigners"},{"title":"StellarSmartWalletMapping","href":"/sdk-reference/wallets/swift/enums/stellarsmartwalletmapping"},{"title":"StellarSupportedToken","href":"/sdk-reference/wallets/swift/enums/stellarsupportedtoken"},{"title":"TokenAccountType","href":"/sdk-reference/wallets/swift/enums/tokenaccounttype"},{"title":"TransactionError","href":"/sdk-reference/wallets/swift/enums/transactionerror"},{"title":"TransactionStatus","href":"/sdk-reference/wallets/swift/enums/transactionstatus"},{"title":"TransactionStatusApiModel","href":"/sdk-reference/wallets/swift/enums/transactionstatusapimodel"},{"title":"TransferTokenLocator","href":"/sdk-reference/wallets/swift/enums/transfertokenlocator"},{"title":"TransferTokenRecipient","href":"/sdk-reference/wallets/swift/enums/transfertokenrecipient"},{"title":"TransferType","href":"/sdk-reference/wallets/swift/enums/transfertype"},{"title":"UnknownChain","href":"/sdk-reference/wallets/swift/enums/unknownchain"},{"title":"WalletError","href":"/sdk-reference/wallets/swift/enums/walleterror"},{"title":"WalletLocator","href":"/sdk-reference/wallets/swift/enums/walletlocator"},{"title":"WalletType","href":"/sdk-reference/wallets/swift/enums/wallettype"}]},{"group":"Structs","pages":[{"title":"ABIAddress","href":"/sdk-reference/wallets/swift/structs/abiaddress"},{"title":"ABIUInt64","href":"/sdk-reference/wallets/swift/structs/abiuint64"},{"title":"AddDelegatedSignerResponse","href":"/sdk-reference/wallets/swift/structs/adddelegatedsignerresponse"},{"title":"ApiKeySignerApiModel","href":"/sdk-reference/wallets/swift/structs/apikeysignerapimodel"},{"title":"ApiKeySignerData","href":"/sdk-reference/wallets/swift/structs/apikeysignerdata"},{"title":"ApprovalEntry","href":"/sdk-reference/wallets/swift/structs/approvalentry"},{"title":"Approvals","href":"/sdk-reference/wallets/swift/structs/approvals"},{"title":"AuthSession","href":"/sdk-reference/wallets/swift/structs/authsession"},{"title":"AuthUser","href":"/sdk-reference/wallets/swift/structs/authuser"},{"title":"Balance","href":"/sdk-reference/wallets/swift/structs/balance"},{"title":"Balances","href":"/sdk-reference/wallets/swift/structs/balances"},{"title":"BlockchainAddressLink","href":"/sdk-reference/wallets/swift/structs/blockchainaddresslink"},{"title":"BlockchainTokenLink","href":"/sdk-reference/wallets/swift/structs/blockchaintokenlink"},{"title":"BlockchainTransactionLink","href":"/sdk-reference/wallets/swift/structs/blockchaintransactionlink"},{"title":"ChainBalances","href":"/sdk-reference/wallets/swift/structs/chainbalances"},{"title":"ChainRegistrationEntry","href":"/sdk-reference/wallets/swift/structs/chainregistrationentry"},{"title":"ChainRegistrationOnChain","href":"/sdk-reference/wallets/swift/structs/chainregistrationonchain"},{"title":"CreateEVMTransactionRequest","href":"/sdk-reference/wallets/swift/structs/createevmtransactionrequest"},{"title":"CreateSignatureRequest","href":"/sdk-reference/wallets/swift/structs/createsignaturerequest"},{"title":"CreateSolanaTransactionRequest","href":"/sdk-reference/wallets/swift/structs/createsolanatransactionrequest"},{"title":"CreateStellarTransactionRequest","href":"/sdk-reference/wallets/swift/structs/createstellartransactionrequest"},{"title":"CreateTransactionRequest","href":"/sdk-reference/wallets/swift/structs/createtransactionrequest"},{"title":"CreateWalletParams","href":"/sdk-reference/wallets/swift/structs/createwalletparams"},{"title":"DelegatedSignerEntry","href":"/sdk-reference/wallets/swift/structs/delegatedsignerentry"},{"title":"DevicePublicKey","href":"/sdk-reference/wallets/swift/structs/devicepublickey"},{"title":"EmailSignerApiModel","href":"/sdk-reference/wallets/swift/structs/emailsignerapimodel"},{"title":"EmailSignerData","href":"/sdk-reference/wallets/swift/structs/emailsignerdata"},{"title":"ERC20Encoder","href":"/sdk-reference/wallets/swift/structs/erc20encoder"},{"title":"EVMAddress","href":"/sdk-reference/wallets/swift/structs/evmaddress"},{"title":"EvmPasskeySignerApiModel","href":"/sdk-reference/wallets/swift/structs/evmpasskeysignerapimodel"},{"title":"EVMTransactionApiModel","href":"/sdk-reference/wallets/swift/structs/evmtransactionapimodel"},{"title":"ExternalWalletSigner","href":"/sdk-reference/wallets/swift/structs/externalwalletsigner"},{"title":"ExternalWalletSignerApiModel","href":"/sdk-reference/wallets/swift/structs/externalwalletsignerapimodel"},{"title":"ExternalWalletSignerData","href":"/sdk-reference/wallets/swift/structs/externalwalletsignerdata"},{"title":"FetchTransactionRequest","href":"/sdk-reference/wallets/swift/structs/fetchtransactionrequest"},{"title":"FundWalletApiRequest","href":"/sdk-reference/wallets/swift/structs/fundwalletapirequest"},{"title":"FundWalletRequest","href":"/sdk-reference/wallets/swift/structs/fundwalletrequest"},{"title":"GetBalanceQueryParams","href":"/sdk-reference/wallets/swift/structs/getbalancequeryparams"},{"title":"GetMeWalletRequest","href":"/sdk-reference/wallets/swift/structs/getmewalletrequest"},{"title":"GetNTFQueryParams","href":"/sdk-reference/wallets/swift/structs/getntfqueryparams"},{"title":"GetTransationQueryParams","href":"/sdk-reference/wallets/swift/structs/gettransationqueryparams"},{"title":"ListTransactionsRequest","href":"/sdk-reference/wallets/swift/structs/listtransactionsrequest"},{"title":"ListTransfersQueryParams","href":"/sdk-reference/wallets/swift/structs/listtransfersqueryparams"},{"title":"LogoutRequest","href":"/sdk-reference/wallets/swift/structs/logoutrequest"},{"title":"MessageSignatureResponse","href":"/sdk-reference/wallets/swift/structs/messagesignatureresponse"},{"title":"NFT","href":"/sdk-reference/wallets/swift/structs/nft"},{"title":"NonCustodialSignerCallback","href":"/sdk-reference/wallets/swift/structs/noncustodialsignercallback"},{"title":"OTPRequest","href":"/sdk-reference/wallets/swift/structs/otprequest"},{"title":"PasskeySignerData","href":"/sdk-reference/wallets/swift/structs/passkeysignerdata"},{"title":"PhoneSignerApiModel","href":"/sdk-reference/wallets/swift/structs/phonesignerapimodel"},{"title":"PhoneSignerData","href":"/sdk-reference/wallets/swift/structs/phonesignerdata"},{"title":"RecoveryMethod","href":"/sdk-reference/wallets/swift/structs/recoverymethod"},{"title":"RefreshJWTRequest","href":"/sdk-reference/wallets/swift/structs/refreshjwtrequest"},{"title":"RefreshJWTResponse","href":"/sdk-reference/wallets/swift/structs/refreshjwtresponse"},{"title":"RegistrationApprovals","href":"/sdk-reference/wallets/swift/structs/registrationapprovals"},{"title":"RegistrationTransaction","href":"/sdk-reference/wallets/swift/structs/registrationtransaction"},{"title":"ServerSignerApiModel","href":"/sdk-reference/wallets/swift/structs/serversignerapimodel"},{"title":"ServerSignerData","href":"/sdk-reference/wallets/swift/structs/serversignerdata"},{"title":"SignerApiModel","href":"/sdk-reference/wallets/swift/structs/signerapimodel"},{"title":"SignMessageRequest","href":"/sdk-reference/wallets/swift/structs/signmessagerequest"},{"title":"SignRequest","href":"/sdk-reference/wallets/swift/structs/signrequest"},{"title":"SignRequestApi","href":"/sdk-reference/wallets/swift/structs/signrequestapi"},{"title":"SignTypedDataRequest","href":"/sdk-reference/wallets/swift/structs/signtypeddatarequest"},{"title":"SolanaAddress","href":"/sdk-reference/wallets/swift/structs/solanaaddress"},{"title":"SolanaTransactionApiModel","href":"/sdk-reference/wallets/swift/structs/solanatransactionapimodel"},{"title":"StellarAddress","href":"/sdk-reference/wallets/swift/structs/stellaraddress"},{"title":"StellarTransactionApiModel","href":"/sdk-reference/wallets/swift/structs/stellartransactionapimodel"},{"title":"SubmittedApprovalEntry","href":"/sdk-reference/wallets/swift/structs/submittedapprovalentry"},{"title":"TokenAccountBalance","href":"/sdk-reference/wallets/swift/structs/tokenaccountbalance"},{"title":"TokenAmount","href":"/sdk-reference/wallets/swift/structs/tokenamount"},{"title":"TokenBalance","href":"/sdk-reference/wallets/swift/structs/tokenbalance"},{"title":"TokenLinkOptions","href":"/sdk-reference/wallets/swift/structs/tokenlinkoptions"},{"title":"Transaction","href":"/sdk-reference/wallets/swift/structs/transaction"},{"title":"TransactionErrorApiModel","href":"/sdk-reference/wallets/swift/structs/transactionerrorapimodel"},{"title":"TransactionSummary","href":"/sdk-reference/wallets/swift/structs/transactionsummary"},{"title":"Transfer","href":"/sdk-reference/wallets/swift/structs/transfer"},{"title":"TransferListResult","href":"/sdk-reference/wallets/swift/structs/transferlistresult"},{"title":"TransferTokenRequest","href":"/sdk-reference/wallets/swift/structs/transfertokenrequest"},{"title":"TypedDataSignatureResponse","href":"/sdk-reference/wallets/swift/structs/typeddatasignatureresponse"},{"title":"ValidateEmailRequest","href":"/sdk-reference/wallets/swift/structs/validateemailrequest"},{"title":"ValidateEmailResponse","href":"/sdk-reference/wallets/swift/structs/validateemailresponse"},{"title":"ValidateTokenRequest","href":"/sdk-reference/wallets/swift/structs/validatetokenrequest"},{"title":"ValidateTokenResponse","href":"/sdk-reference/wallets/swift/structs/validatetokenresponse"},{"title":"WalletApiModel","href":"/sdk-reference/wallets/swift/structs/walletapimodel"},{"title":"WalletConfig","href":"/sdk-reference/wallets/swift/structs/walletconfig"},{"title":"WalletConfigApiModel","href":"/sdk-reference/wallets/swift/structs/walletconfigapimodel"},{"title":"WalletOptions","href":"/sdk-reference/wallets/swift/structs/walletoptions"},{"title":"WalletSigner","href":"/sdk-reference/wallets/swift/structs/walletsigner"}]},{"group":"Type Aliases","pages":[{"title":"EmailSignerError","href":"/sdk-reference/wallets/swift/type-aliases/emailsignererror"},{"title":"Secp256k1PrivateKey","href":"/sdk-reference/wallets/swift/type-aliases/secp256k1privatekey"},{"title":"Secp256k1PublicKey","href":"/sdk-reference/wallets/swift/type-aliases/secp256k1publickey"}]},{"group":"Functions","pages":[{"title":"getBlockchainExplorerURL(for:)","href":"/sdk-reference/wallets/swift/functions/getblockchainexplorerurl-for"}]},{"group":"Extensions","pages":[{"title":"Logger","href":"/sdk-reference/wallets/swift/extensions/logger"},{"title":"SwiftUICore","href":"/sdk-reference/wallets/swift/extensions/swiftuicore"}]}]},{"group":"Kotlin SDK","icon":"/images/icons/kotlin.png","pages":[{"title":"Kotlin SDK Reference","href":"/sdk-reference/wallets/kotlin/index"},{"group":"Classes","pages":[{"title":"AndroidCrossmintTEE","href":"/sdk-reference/wallets/kotlin/classes/android-crossmint-tee"},{"title":"AndroidPasskeyProvider","href":"/sdk-reference/wallets/kotlin/classes/android-passkey-provider"},{"title":"AndroidWebViewBridge","href":"/sdk-reference/wallets/kotlin/classes/android-web-view-bridge"},{"title":"AuthSessionStore","href":"/sdk-reference/wallets/kotlin/classes/auth-session-store"},{"title":"Crossmint","deprecated":true,"href":"/sdk-reference/wallets/kotlin/classes/crossmint"},{"title":"CrossmintAuthManager","href":"/sdk-reference/wallets/kotlin/classes/crossmint-auth-manager"},{"title":"CrossmintSDK","href":"/sdk-reference/wallets/kotlin/classes/crossmint-sdk"},{"title":"DelegatedSigner.PasskeyActivation","href":"/sdk-reference/wallets/kotlin/classes/delegated-signer-passkey-activation"},{"title":"DeviceSignerStorageFactory","href":"/sdk-reference/wallets/kotlin/classes/device-signer-storage-factory"},{"title":"EncryptedSharedPreferenceStorage","href":"/sdk-reference/wallets/kotlin/classes/encrypted-shared-preference-storage"},{"title":"EVMWallet","href":"/sdk-reference/wallets/kotlin/classes/evm-wallet"},{"title":"FallbackPolicy.InsecurePersistent","href":"/sdk-reference/wallets/kotlin/classes/fallback-policy-insecure-persistent"},{"title":"FallbackPolicy.MemoryOnly","href":"/sdk-reference/wallets/kotlin/classes/fallback-policy-memory-only"},{"title":"InsecurePersistentSessionStore","href":"/sdk-reference/wallets/kotlin/classes/insecure-persistent-session-store"},{"title":"InvalidEnvironmentKeyException","href":"/sdk-reference/wallets/kotlin/classes/invalid-environment-key-exception"},{"title":"JvmWebViewBridge","href":"/sdk-reference/wallets/kotlin/classes/jvm-web-view-bridge"},{"title":"KeystoreKeyStorage","href":"/sdk-reference/wallets/kotlin/classes/keystore-key-storage"},{"title":"MalformedKeyException","href":"/sdk-reference/wallets/kotlin/classes/malformed-key-exception"},{"title":"OldKeyException","href":"/sdk-reference/wallets/kotlin/classes/old-key-exception"},{"title":"SolanaWallet","href":"/sdk-reference/wallets/kotlin/classes/solana-wallet"},{"title":"StellarWallet","href":"/sdk-reference/wallets/kotlin/classes/stellar-wallet"},{"title":"TinkSecureStorage","href":"/sdk-reference/wallets/kotlin/classes/tink-secure-storage"},{"title":"TinkWithFallbackSessionStore","href":"/sdk-reference/wallets/kotlin/classes/tink-with-fallback-session-store"},{"title":"Wallet","href":"/sdk-reference/wallets/kotlin/classes/wallet"},{"title":"WebViewNotAvailableException","href":"/sdk-reference/wallets/kotlin/classes/web-view-not-available-exception"}]},{"group":"Interfaces","pages":[{"title":"AuthManager","href":"/sdk-reference/wallets/kotlin/interfaces/auth-manager"},{"title":"AuthService","href":"/sdk-reference/wallets/kotlin/interfaces/auth-service"},{"title":"BalanceOperations","href":"/sdk-reference/wallets/kotlin/interfaces/balance-operations"},{"title":"CrossmintTEE","href":"/sdk-reference/wallets/kotlin/interfaces/crossmint-tee"},{"title":"CrossmintWallets","href":"/sdk-reference/wallets/kotlin/interfaces/crossmint-wallets"},{"title":"DeviceSignerKeyStorage","href":"/sdk-reference/wallets/kotlin/interfaces/device-signer-key-storage"},{"title":"EmailSigner","href":"/sdk-reference/wallets/kotlin/interfaces/email-signer"},{"title":"FailureAwareSessionStore","href":"/sdk-reference/wallets/kotlin/interfaces/failure-aware-session-store"},{"title":"NFTOperations","href":"/sdk-reference/wallets/kotlin/interfaces/nft-operations"},{"title":"NonCustodialSigner","href":"/sdk-reference/wallets/kotlin/interfaces/non-custodial-signer"},{"title":"PasskeyProvider","href":"/sdk-reference/wallets/kotlin/interfaces/passkey-provider"},{"title":"SessionStore","href":"/sdk-reference/wallets/kotlin/interfaces/session-store"},{"title":"Signer","href":"/sdk-reference/wallets/kotlin/interfaces/signer"},{"title":"SignerManagementOperations","href":"/sdk-reference/wallets/kotlin/interfaces/signer-management-operations"},{"title":"TransactionOperations","href":"/sdk-reference/wallets/kotlin/interfaces/transaction-operations"}]},{"group":"Enums","pages":[{"title":"ApiKey.Type","href":"/sdk-reference/wallets/kotlin/enums/api-key-type"},{"title":"AuthErrorCode","href":"/sdk-reference/wallets/kotlin/enums/auth-error-code"},{"title":"BalanceErrorCode","href":"/sdk-reference/wallets/kotlin/enums/balance-error-code"},{"title":"ChainType","href":"/sdk-reference/wallets/kotlin/enums/chain-type"},{"title":"ConfigurationErrorCode","href":"/sdk-reference/wallets/kotlin/enums/configuration-error-code"},{"title":"DelegatedSignerStatus","href":"/sdk-reference/wallets/kotlin/enums/delegated-signer-status"},{"title":"DelegatedSignerType","href":"/sdk-reference/wallets/kotlin/enums/delegated-signer-type"},{"title":"Environment","href":"/sdk-reference/wallets/kotlin/enums/environment"},{"title":"FallbackPolicy","href":"/sdk-reference/wallets/kotlin/enums/fallback-policy"},{"title":"IdentityVerificationErrorCode","href":"/sdk-reference/wallets/kotlin/enums/identity-verification-error-code"},{"title":"LogLevel","href":"/sdk-reference/wallets/kotlin/enums/log-level"},{"title":"NetworkErrorCode","href":"/sdk-reference/wallets/kotlin/enums/network-error-code"},{"title":"OfframpErrorCode","href":"/sdk-reference/wallets/kotlin/enums/offramp-error-code"},{"title":"OTPDeliveryChannel","href":"/sdk-reference/wallets/kotlin/enums/otp-delivery-channel"},{"title":"PasskeyErrorCode","href":"/sdk-reference/wallets/kotlin/enums/passkey-error-code"},{"title":"SignatureErrorCode","href":"/sdk-reference/wallets/kotlin/enums/signature-error-code"},{"title":"TransactionErrorCode","href":"/sdk-reference/wallets/kotlin/enums/transaction-error-code"},{"title":"TransactionStatus","href":"/sdk-reference/wallets/kotlin/enums/transaction-status"},{"title":"TransferErrorCode","href":"/sdk-reference/wallets/kotlin/enums/transfer-error-code"},{"title":"TransferType","href":"/sdk-reference/wallets/kotlin/enums/transfer-type"},{"title":"WalletErrorCode","href":"/sdk-reference/wallets/kotlin/enums/wallet-error-code"},{"title":"WalletType","href":"/sdk-reference/wallets/kotlin/enums/wallet-type"}]},{"group":"Data Classes","pages":[{"title":"ApiKey","href":"/sdk-reference/wallets/kotlin/data-classes/api-key"},{"title":"ApiKeyError.InvalidEnvironmentKey","href":"/sdk-reference/wallets/kotlin/data-classes/api-key-error-invalid-environment-key"},{"title":"ApiKeyError.MalformedKey","href":"/sdk-reference/wallets/kotlin/data-classes/api-key-error-malformed-key"},{"title":"ApiKeyError.OldKey","href":"/sdk-reference/wallets/kotlin/data-classes/api-key-error-old-key"},{"title":"Approval","href":"/sdk-reference/wallets/kotlin/data-classes/approval"},{"title":"ApprovalMetadata.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/approval-metadata-passkey"},{"title":"ApprovalSignature.Device","href":"/sdk-reference/wallets/kotlin/data-classes/approval-signature-device"},{"title":"ApprovalSignature.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/approval-signature-passkey"},{"title":"ApprovalSignature.Raw","href":"/sdk-reference/wallets/kotlin/data-classes/approval-signature-raw"},{"title":"Approvals","href":"/sdk-reference/wallets/kotlin/data-classes/approvals"},{"title":"Approvals.PendingApproval","href":"/sdk-reference/wallets/kotlin/data-classes/approvals-pending-approval"},{"title":"Approvals.QuorumApproval","href":"/sdk-reference/wallets/kotlin/data-classes/approvals-quorum-approval"},{"title":"Approvals.SubmittedApproval","href":"/sdk-reference/wallets/kotlin/data-classes/approvals-submitted-approval"},{"title":"AuthError.InvalidCredentials","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-invalid-credentials"},{"title":"AuthError.NotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-not-initialized"},{"title":"AuthError.RateLimited","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-rate-limited"},{"title":"AuthError.ServerError","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-server-error"},{"title":"AuthError.TokenExpired","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-token-expired"},{"title":"AuthError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/auth-error-unauthorized"},{"title":"BalanceError.BalanceNotFound","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-balance-not-found"},{"title":"BalanceError.BalanceOperationFailed","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-balance-operation-failed"},{"title":"BalanceError.Forbidden","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-forbidden"},{"title":"BalanceError.RateLimited","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-rate-limited"},{"title":"BalanceError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-service-not-initialized"},{"title":"BalanceError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/balance-error-unauthorized"},{"title":"Balances","href":"/sdk-reference/wallets/kotlin/data-classes/balances"},{"title":"Call","href":"/sdk-reference/wallets/kotlin/data-classes/call"},{"title":"ChainInfo.Solana","href":"/sdk-reference/wallets/kotlin/data-classes/chain-info-solana"},{"title":"ChainInfo.Stellar","href":"/sdk-reference/wallets/kotlin/data-classes/chain-info-stellar"},{"title":"Chain.Unknown","href":"/sdk-reference/wallets/kotlin/data-classes/chain-unknown"},{"title":"Configuration","href":"/sdk-reference/wallets/kotlin/data-classes/configuration"},{"title":"DelegatedSigner.ApiKey","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-api-key"},{"title":"DelegatedSignerData","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-data"},{"title":"DelegatedSigner.Device","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-device"},{"title":"DelegatedSigner.Email","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-email"},{"title":"DelegatedSigner.ExternalWallet","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-external-wallet"},{"title":"DelegatedSigner.Locator","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-locator"},{"title":"DelegatedSigner.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-passkey"},{"title":"DelegatedSigner.Phone","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-phone"},{"title":"DelegatedSigner.Quorum","href":"/sdk-reference/wallets/kotlin/data-classes/delegated-signer-quorum"},{"title":"DeviceSignerError.StorageError","href":"/sdk-reference/wallets/kotlin/data-classes/device-signer-error-storage-error"},{"title":"EVMTransactionParams","href":"/sdk-reference/wallets/kotlin/data-classes/evm-transaction-params"},{"title":"FeeConfig","href":"/sdk-reference/wallets/kotlin/data-classes/fee-config"},{"title":"IdentityVerificationError","href":"/sdk-reference/wallets/kotlin/data-classes/identity-verification-error"},{"title":"NetworkError.ConnectionError","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-connection-error"},{"title":"NetworkError.HttpError","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-http-error"},{"title":"NetworkError.ParseError","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-parse-error"},{"title":"NetworkError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-service-not-initialized"},{"title":"NetworkError.TimeoutError","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-timeout-error"},{"title":"NetworkError.UnknownError","href":"/sdk-reference/wallets/kotlin/data-classes/network-error-unknown-error"},{"title":"OfframpError","href":"/sdk-reference/wallets/kotlin/data-classes/offramp-error"},{"title":"OnChainData","href":"/sdk-reference/wallets/kotlin/data-classes/on-chain-data"},{"title":"Owner.Address","href":"/sdk-reference/wallets/kotlin/data-classes/owner-address"},{"title":"Owner.Email","href":"/sdk-reference/wallets/kotlin/data-classes/owner-email"},{"title":"Owner.PhoneNumber","href":"/sdk-reference/wallets/kotlin/data-classes/owner-phone-number"},{"title":"Owner.Twitter","href":"/sdk-reference/wallets/kotlin/data-classes/owner-twitter"},{"title":"Owner.UserId","href":"/sdk-reference/wallets/kotlin/data-classes/owner-user-id"},{"title":"PasskeyCredentialInfo","href":"/sdk-reference/wallets/kotlin/data-classes/passkey-credential-info"},{"title":"PasskeyError.Cancelled","href":"/sdk-reference/wallets/kotlin/data-classes/passkey-error-cancelled"},{"title":"PasskeyError.Failed","href":"/sdk-reference/wallets/kotlin/data-classes/passkey-error-failed"},{"title":"PasskeySignMetadata","href":"/sdk-reference/wallets/kotlin/data-classes/passkey-sign-metadata"},{"title":"PasskeySignResult","href":"/sdk-reference/wallets/kotlin/data-classes/passkey-sign-result"},{"title":"RawTransactionParams.Solana","href":"/sdk-reference/wallets/kotlin/data-classes/raw-transaction-params-solana"},{"title":"RawTransactionParams.Stellar","href":"/sdk-reference/wallets/kotlin/data-classes/raw-transaction-params-stellar"},{"title":"RawTransactionParams.StellarSerialized","href":"/sdk-reference/wallets/kotlin/data-classes/raw-transaction-params-stellar-serialized"},{"title":"RecoveryMethod","href":"/sdk-reference/wallets/kotlin/data-classes/recovery-method"},{"title":"Result.Failure","href":"/sdk-reference/wallets/kotlin/data-classes/result-failure"},{"title":"Result.Success","href":"/sdk-reference/wallets/kotlin/data-classes/result-success"},{"title":"SignatureError.ChainNotSupported","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-chain-not-supported"},{"title":"SignatureError.CreationFailed","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-creation-failed"},{"title":"SignatureError.Forbidden","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-forbidden"},{"title":"SignatureError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-service-not-initialized"},{"title":"SignatureError.SigningFailed","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-signing-failed"},{"title":"SignatureError.Timeout","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-timeout"},{"title":"SignatureError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-unauthorized"},{"title":"SignatureError.Unknown","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-unknown"},{"title":"SignatureError.UserCancelled","href":"/sdk-reference/wallets/kotlin/data-classes/signature-error-user-cancelled"},{"title":"SignerChangeResult","href":"/sdk-reference/wallets/kotlin/data-classes/signer-change-result"},{"title":"SignerData.ApiKey","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-api-key"},{"title":"SignerData.Device","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-device"},{"title":"SignerData.Email","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-email"},{"title":"SignerData.ExternalWallet","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-external-wallet"},{"title":"SignerData.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-passkey"},{"title":"SignerData.Phone","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-phone"},{"title":"SignerData.Quorum","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-quorum"},{"title":"SignerData.Server","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-server"},{"title":"SignerData.Unknown","href":"/sdk-reference/wallets/kotlin/data-classes/signer-data-unknown"},{"title":"SignerError.Generic","href":"/sdk-reference/wallets/kotlin/data-classes/signer-error-generic"},{"title":"SignerError.SigningFailed","href":"/sdk-reference/wallets/kotlin/data-classes/signer-error-signing-failed"},{"title":"SignerSelection.Delegated","href":"/sdk-reference/wallets/kotlin/data-classes/signer-selection-delegated"},{"title":"SignerSelection.Quorum","href":"/sdk-reference/wallets/kotlin/data-classes/signer-selection-quorum"},{"title":"SignerType.Email","href":"/sdk-reference/wallets/kotlin/data-classes/signer-type-email"},{"title":"SignerType.ExternalWallet","href":"/sdk-reference/wallets/kotlin/data-classes/signer-type-external-wallet"},{"title":"SignerType.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/signer-type-passkey"},{"title":"SignerType.Phone","href":"/sdk-reference/wallets/kotlin/data-classes/signer-type-phone"},{"title":"SignerType.Quorum","href":"/sdk-reference/wallets/kotlin/data-classes/signer-type-quorum"},{"title":"SigningOutput.Passkey","href":"/sdk-reference/wallets/kotlin/data-classes/signing-output-passkey"},{"title":"SigningOutput.Standard","href":"/sdk-reference/wallets/kotlin/data-classes/signing-output-standard"},{"title":"SolanaTransactionParams","href":"/sdk-reference/wallets/kotlin/data-classes/solana-transaction-params"},{"title":"StellarTransactionParams","href":"/sdk-reference/wallets/kotlin/data-classes/stellar-transaction-params"},{"title":"TEEError.Generic","href":"/sdk-reference/wallets/kotlin/data-classes/tee-error-generic"},{"title":"TEEError.InvalidPayload","href":"/sdk-reference/wallets/kotlin/data-classes/tee-error-invalid-payload"},{"title":"TokenAccountBalance","href":"/sdk-reference/wallets/kotlin/data-classes/token-account-balance"},{"title":"TokenAccountType.Card","href":"/sdk-reference/wallets/kotlin/data-classes/token-account-type-card"},{"title":"TokenAccountType.Unknown","href":"/sdk-reference/wallets/kotlin/data-classes/token-account-type-unknown"},{"title":"TokenAmount","href":"/sdk-reference/wallets/kotlin/data-classes/token-amount"},{"title":"TokenBalance","href":"/sdk-reference/wallets/kotlin/data-classes/token-balance"},{"title":"Transaction","href":"/sdk-reference/wallets/kotlin/data-classes/transaction"},{"title":"TransactionErrorDetails","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-details"},{"title":"TransactionErrorDetails.Revert","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-details-revert"},{"title":"TransactionError.Forbidden","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-forbidden"},{"title":"TransactionError.InvalidTransactionState","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-invalid-transaction-state"},{"title":"TransactionError.QuorumSelectionAmbiguous","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-quorum-selection-ambiguous"},{"title":"TransactionError.RateLimited","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-rate-limited"},{"title":"TransactionError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-service-not-initialized"},{"title":"TransactionError.SignerIsQuorumMember","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-signer-is-quorum-member"},{"title":"TransactionError.SigningFailed","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-signing-failed"},{"title":"TransactionError.Timeout","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-timeout"},{"title":"TransactionError.TransactionCreationFailed","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-transaction-creation-failed"},{"title":"TransactionError.TransactionExpired","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-transaction-expired"},{"title":"TransactionError.TransactionFailed","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-transaction-failed"},{"title":"TransactionError.TransactionNotFound","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-transaction-not-found"},{"title":"TransactionError.TransactionOperationFailed","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-transaction-operation-failed"},{"title":"TransactionError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-unauthorized"},{"title":"TransactionError.UserCancelled","href":"/sdk-reference/wallets/kotlin/data-classes/transaction-error-user-cancelled"},{"title":"Transfer","href":"/sdk-reference/wallets/kotlin/data-classes/transfer"},{"title":"TransferError.LoadFailed","href":"/sdk-reference/wallets/kotlin/data-classes/transfer-error-load-failed"},{"title":"TransferError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/transfer-error-service-not-initialized"},{"title":"TransferError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/transfer-error-unauthorized"},{"title":"TransferError.Unknown","href":"/sdk-reference/wallets/kotlin/data-classes/transfer-error-unknown"},{"title":"TransferList","href":"/sdk-reference/wallets/kotlin/data-classes/transfer-list"},{"title":"UserOperation","href":"/sdk-reference/wallets/kotlin/data-classes/user-operation"},{"title":"WalletConfig","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-config"},{"title":"WalletError.ChainNotSupported","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-chain-not-supported"},{"title":"WalletError.DelegatedSignerConflict","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-delegated-signer-conflict"},{"title":"WalletError.DeviceKeyIndexUnreadable","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-device-key-index-unreadable"},{"title":"WalletError.DeviceSignerNotSupported","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-device-signer-not-supported"},{"title":"WalletError.DuplicateRecoverySigner","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-duplicate-recovery-signer"},{"title":"WalletError.Forbidden","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-forbidden"},{"title":"WalletError.InvalidInput","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-invalid-input"},{"title":"WalletError.InvalidQuorum","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-invalid-quorum"},{"title":"WalletError.InvalidRecoveryConfig","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-invalid-recovery-config"},{"title":"WalletError.InvalidSigner","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-invalid-signer"},{"title":"WalletError.LastRecoverySigner","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-last-recovery-signer"},{"title":"WalletError.QuorumNotSupportedOnChain","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-quorum-not-supported-on-chain"},{"title":"WalletError.QuorumSelectionAmbiguous","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-quorum-selection-ambiguous"},{"title":"WalletError.RateLimited","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-rate-limited"},{"title":"WalletError.RecoveryAdminSignerConflict","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-recovery-admin-signer-conflict"},{"title":"WalletError.RecoveryNotSupportedOnApiVersion","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-recovery-not-supported-on-api-version"},{"title":"WalletError.RecoveryNotSupportedOnChain","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-recovery-not-supported-on-chain"},{"title":"WalletError.RecoverySignerConflict","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-recovery-signer-conflict"},{"title":"WalletError.RecoverySignerNotAllowed","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-recovery-signer-not-allowed"},{"title":"WalletError.ServiceNotInitialized","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-service-not-initialized"},{"title":"WalletError.SignerLimitExceeded","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-signer-limit-exceeded"},{"title":"WalletError.SignerNotRegistered","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-signer-not-registered"},{"title":"WalletError.SignerRequired","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-signer-required"},{"title":"WalletError.SigningError","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-signing-error"},{"title":"WalletError.Unauthorized","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-unauthorized"},{"title":"WalletError.WalletNotFound","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-wallet-not-found"},{"title":"WalletError.WalletOperationFailed","href":"/sdk-reference/wallets/kotlin/data-classes/wallet-error-wallet-operation-failed"},{"title":"WebViewMessage.Custom","href":"/sdk-reference/wallets/kotlin/data-classes/web-view-message-custom"}]},{"group":"Sealed Classes","pages":[{"title":"ApprovalMetadata","href":"/sdk-reference/wallets/kotlin/sealed-classes/approval-metadata"},{"title":"ApprovalSignature","href":"/sdk-reference/wallets/kotlin/sealed-classes/approval-signature"},{"title":"DelegatedSigner","href":"/sdk-reference/wallets/kotlin/sealed-classes/delegated-signer"},{"title":"DeviceSignerError","href":"/sdk-reference/wallets/kotlin/sealed-classes/device-signer-error"},{"title":"Owner","href":"/sdk-reference/wallets/kotlin/sealed-classes/owner"},{"title":"RawTransactionParams","href":"/sdk-reference/wallets/kotlin/sealed-classes/raw-transaction-params"},{"title":"SignerData","href":"/sdk-reference/wallets/kotlin/sealed-classes/signer-data"},{"title":"SignerError","href":"/sdk-reference/wallets/kotlin/sealed-classes/signer-error"},{"title":"SignerSelection","href":"/sdk-reference/wallets/kotlin/sealed-classes/signer-selection"},{"title":"SignerType","href":"/sdk-reference/wallets/kotlin/sealed-classes/signer-type"},{"title":"SigningOutput","href":"/sdk-reference/wallets/kotlin/sealed-classes/signing-output"},{"title":"TEEError","href":"/sdk-reference/wallets/kotlin/sealed-classes/tee-error"}]},{"group":"Sealed Interfaces","pages":[{"title":"ApiKeyError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/api-key-error"},{"title":"AuthError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/auth-error"},{"title":"BalanceError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/balance-error"},{"title":"Chain","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/chain"},{"title":"ChainInfo","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/chain-info"},{"title":"ConfigurationError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/configuration-error"},{"title":"CrossmintError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/crossmint-error"},{"title":"CrossmintErrorCode","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/crossmint-error-code"},{"title":"EVMChain","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/evm-chain"},{"title":"NetworkError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/network-error"},{"title":"PasskeyError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/passkey-error"},{"title":"Result","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/result"},{"title":"SignatureError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/signature-error"},{"title":"SolanaChain","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/solana-chain"},{"title":"StellarChain","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/stellar-chain"},{"title":"SupportedChain","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/supported-chain"},{"title":"TokenAccountType","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/token-account-type"},{"title":"TransactionError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/transaction-error"},{"title":"TransactionParams","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/transaction-params"},{"title":"TransferError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/transfer-error"},{"title":"WalletError","href":"/sdk-reference/wallets/kotlin/sealed-interfaces/wallet-error"}]},{"group":"Objects","pages":[{"title":"ApiKey.Companion","href":"/sdk-reference/wallets/kotlin/objects/api-key-companion"},{"title":"Chain.Companion","href":"/sdk-reference/wallets/kotlin/objects/chain-companion"},{"title":"Configuration.Companion","href":"/sdk-reference/wallets/kotlin/objects/configuration-companion"},{"title":"CrossmintAuthManager.Companion","href":"/sdk-reference/wallets/kotlin/objects/crossmint-auth-manager-companion"},{"title":"Crossmint.Companion","href":"/sdk-reference/wallets/kotlin/objects/crossmint-companion"},{"title":"CrossmintSDK.Companion","href":"/sdk-reference/wallets/kotlin/objects/crossmint-sdk-companion"},{"title":"DelegatedSignerStatus.Companion","href":"/sdk-reference/wallets/kotlin/objects/delegated-signer-status-companion"},{"title":"DelegatedSignerType.Companion","href":"/sdk-reference/wallets/kotlin/objects/delegated-signer-type-companion"},{"title":"DeviceSignerError.HardwareUnavailable","href":"/sdk-reference/wallets/kotlin/objects/device-signer-error-hardware-unavailable"},{"title":"DeviceSignerError.InvalidMessage","href":"/sdk-reference/wallets/kotlin/objects/device-signer-error-invalid-message"},{"title":"DeviceSignerError.KeyGenerationFailed","href":"/sdk-reference/wallets/kotlin/objects/device-signer-error-key-generation-failed"},{"title":"DeviceSignerError.KeyNotFound","href":"/sdk-reference/wallets/kotlin/objects/device-signer-error-key-not-found"},{"title":"DeviceSignerError.SigningFailed","href":"/sdk-reference/wallets/kotlin/objects/device-signer-error-signing-failed"},{"title":"EncryptedSharedPreferenceStorage.Companion","href":"/sdk-reference/wallets/kotlin/objects/encrypted-shared-preference-storage-companion"},{"title":"EVMChain.Apechain","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-apechain"},{"title":"EVMChain.Apex","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-apex"},{"title":"EVMChain.Arbitrum","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-arbitrum"},{"title":"EVMChain.ArbitrumNova","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-arbitrum-nova"},{"title":"EVMChain.ArbitrumSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-arbitrum-sepolia"},{"title":"EVMChain.AstarZkEVM","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-astar-zk-evm"},{"title":"EVMChain.Avalanche","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-avalanche"},{"title":"EVMChain.AvalancheFuji","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-avalanche-fuji"},{"title":"EVMChain.BarretTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-barret-testnet"},{"title":"EVMChain.Base","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-base"},{"title":"EVMChain.BaseGoerli","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-base-goerli"},{"title":"EVMChain.BaseSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-base-sepolia"},{"title":"EVMChain.Boss","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-boss"},{"title":"EVMChain.BSCTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-bsc-testnet"},{"title":"EVMChain.Chiliz","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-chiliz"},{"title":"EVMChain.ChilizSpicyTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-chiliz-spicy-testnet"},{"title":"EVMChain.Coti","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-coti"},{"title":"EVMChain.CotiTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-coti-testnet"},{"title":"EVMChain.Curtis","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-curtis"},{"title":"EVMChain.Ethereum","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-ethereum"},{"title":"EVMChain.EthereumGoerli","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-ethereum-goerli"},{"title":"EVMChain.EthereumSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-ethereum-sepolia"},{"title":"EVMChain.HypersonicTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-hypersonic-testnet"},{"title":"EVMChain.Lightlink","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-lightlink"},{"title":"EVMChain.LightlinkPegasus","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-lightlink-pegasus"},{"title":"EVMChain.Mode","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-mode"},{"title":"EVMChain.ModeSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-mode-sepolia"},{"title":"EVMChain.Optimism","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-optimism"},{"title":"EVMChain.OptimismGoerli","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-optimism-goerli"},{"title":"EVMChain.OptimismSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-optimism-sepolia"},{"title":"EVMChain.Polygon","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-polygon"},{"title":"EVMChain.PolygonAmoy","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-polygon-amoy"},{"title":"EVMChain.PolygonMumbai","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-polygon-mumbai"},{"title":"EVMChain.Rari","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-rari"},{"title":"EVMChain.RariTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-rari-testnet"},{"title":"EVMChain.Scroll","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-scroll"},{"title":"EVMChain.ScrollSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-scroll-sepolia"},{"title":"EVMChain.SeiAtlantic2Testnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-sei-atlantic2testnet"},{"title":"EVMChain.SeiPacific1","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-sei-pacific1"},{"title":"EVMChain.Shape","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-shape"},{"title":"EVMChain.ShapeSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-shape-sepolia"},{"title":"EVMChain.SkaleNebula","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-skale-nebula"},{"title":"EVMChain.SkaleNebulaTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-skale-nebula-testnet"},{"title":"EVMChain.Soneium","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-soneium"},{"title":"EVMChain.SoneiumMinatoTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-soneium-minato-testnet"},{"title":"EVMChain.Space","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-space"},{"title":"EVMChain.SpaceTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-space-testnet"},{"title":"EVMChain.Story","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-story"},{"title":"EVMChain.StoryTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-story-testnet"},{"title":"EVMChain.VerifyTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-verify-testnet"},{"title":"EVMChain.Viction","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-viction"},{"title":"EVMChain.VictionTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-viction-testnet"},{"title":"EVMChain.Xai","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-xai"},{"title":"EVMChain.XaiSepoliaTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-xai-sepolia-testnet"},{"title":"EVMChain.ZenchainTestnet","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zenchain-testnet"},{"title":"EVMChain.Zkatana","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zkatana"},{"title":"EVMChain.Zkyoto","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zkyoto"},{"title":"EVMChain.Zora","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zora"},{"title":"EVMChain.ZoraGoerli","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zora-goerli"},{"title":"EVMChain.ZoraSepolia","href":"/sdk-reference/wallets/kotlin/objects/evm-chain-zora-sepolia"},{"title":"InsecurePersistentSessionStore.Companion","href":"/sdk-reference/wallets/kotlin/objects/insecure-persistent-session-store-companion"},{"title":"KeystoreKeyStorage.Companion","href":"/sdk-reference/wallets/kotlin/objects/keystore-key-storage-companion"},{"title":"SignerError.Cancelled","href":"/sdk-reference/wallets/kotlin/objects/signer-error-cancelled"},{"title":"SignerError.InvalidEmail","href":"/sdk-reference/wallets/kotlin/objects/signer-error-invalid-email"},{"title":"SignerError.NotInitialized","href":"/sdk-reference/wallets/kotlin/objects/signer-error-not-initialized"},{"title":"SignerError.NotStarted","href":"/sdk-reference/wallets/kotlin/objects/signer-error-not-started"},{"title":"SignerError.TeeNotStarted","href":"/sdk-reference/wallets/kotlin/objects/signer-error-tee-not-started"},{"title":"SignerSelection.Admin","href":"/sdk-reference/wallets/kotlin/objects/signer-selection-admin"},{"title":"SignerType.ApiKey","href":"/sdk-reference/wallets/kotlin/objects/signer-type-api-key"},{"title":"SolanaChain.Solana","href":"/sdk-reference/wallets/kotlin/objects/solana-chain-solana"},{"title":"StellarChain.Stellar","href":"/sdk-reference/wallets/kotlin/objects/stellar-chain-stellar"},{"title":"TEEError.EncryptionUnavailable","href":"/sdk-reference/wallets/kotlin/objects/tee-error-encryption-unavailable"},{"title":"TEEError.ErrorLoadingService","href":"/sdk-reference/wallets/kotlin/objects/tee-error-error-loading-service"},{"title":"TEEError.HandshakeFailed","href":"/sdk-reference/wallets/kotlin/objects/tee-error-handshake-failed"},{"title":"TEEError.HandshakeRequired","href":"/sdk-reference/wallets/kotlin/objects/tee-error-handshake-required"},{"title":"TEEError.InvalidSignature","href":"/sdk-reference/wallets/kotlin/objects/tee-error-invalid-signature"},{"title":"TEEError.JWTRequired","href":"/sdk-reference/wallets/kotlin/objects/tee-error-jwt-required"},{"title":"TEEError.SignerStatusUnavailable","href":"/sdk-reference/wallets/kotlin/objects/tee-error-signer-status-unavailable"},{"title":"TEEError.Timeout","href":"/sdk-reference/wallets/kotlin/objects/tee-error-timeout"},{"title":"TEEError.UserCancelled","href":"/sdk-reference/wallets/kotlin/objects/tee-error-user-cancelled"},{"title":"TinkSecureStorage.Companion","href":"/sdk-reference/wallets/kotlin/objects/tink-secure-storage-companion"},{"title":"TinkWithFallbackSessionStore.Companion","href":"/sdk-reference/wallets/kotlin/objects/tink-with-fallback-session-store-companion"},{"title":"TokenAccountType.Wallet","href":"/sdk-reference/wallets/kotlin/objects/token-account-type-wallet"}]},{"group":"Composables","pages":[{"title":"CrossmintNonCustodialSignerProvider","href":"/sdk-reference/wallets/kotlin/composables/crossmint-non-custodial-signer-provider"},{"title":"CrossmintTEEWebView","href":"/sdk-reference/wallets/kotlin/composables/crossmint-tee-web-view"},{"title":"CrossmintTEEWebViewContainer","href":"/sdk-reference/wallets/kotlin/composables/crossmint-tee-web-view-container"},{"title":"PlatformSpecificProvider","href":"/sdk-reference/wallets/kotlin/composables/platform-specific-provider"}]},{"group":"Functions","pages":[{"title":"configure","href":"/sdk-reference/wallets/kotlin/functions/configure"},{"title":"createAndroidTEE","href":"/sdk-reference/wallets/kotlin/functions/create-android-tee"},{"title":"createAuthManager","href":"/sdk-reference/wallets/kotlin/functions/create-auth-manager"},{"title":"createCrossmintWallets","href":"/sdk-reference/wallets/kotlin/functions/create-crossmint-wallets"},{"title":"createDefaultAuthManager","href":"/sdk-reference/wallets/kotlin/functions/create-default-auth-manager"},{"title":"createDefaultSessionStore","href":"/sdk-reference/wallets/kotlin/functions/create-default-session-store"},{"title":"createEVMWallet","href":"/sdk-reference/wallets/kotlin/functions/create-evm-wallet"},{"title":"createPasskeyCredential","href":"/sdk-reference/wallets/kotlin/functions/create-passkey-credential"},{"title":"createSolanaWallet","href":"/sdk-reference/wallets/kotlin/functions/create-solana-wallet"},{"title":"createStellarWallet","href":"/sdk-reference/wallets/kotlin/functions/create-stellar-wallet"},{"title":"createWallet","href":"/sdk-reference/wallets/kotlin/functions/create-wallet"},{"title":"CrossmintTEEWebView","href":"/sdk-reference/wallets/kotlin/functions/crossmint-tee-web-view"},{"title":"flatMap","href":"/sdk-reference/wallets/kotlin/functions/flat-map"},{"title":"fold","href":"/sdk-reference/wallets/kotlin/functions/fold"},{"title":"getOrNull","href":"/sdk-reference/wallets/kotlin/functions/get-or-null"},{"title":"getOrThrow","href":"/sdk-reference/wallets/kotlin/functions/get-or-throw"},{"title":"isMainThread","href":"/sdk-reference/wallets/kotlin/functions/is-main-thread"},{"title":"makePasskeySignerCallback","href":"/sdk-reference/wallets/kotlin/functions/make-passkey-signer-callback"},{"title":"map","href":"/sdk-reference/wallets/kotlin/functions/map"},{"title":"mapError","href":"/sdk-reference/wallets/kotlin/functions/map-error"},{"title":"normalizeEmail","href":"/sdk-reference/wallets/kotlin/functions/normalize-email"},{"title":"runCatching","href":"/sdk-reference/wallets/kotlin/functions/run-catching"},{"title":"useSigner","href":"/sdk-reference/wallets/kotlin/functions/use-signer"},{"title":"waitForMessage","href":"/sdk-reference/wallets/kotlin/functions/wait-for-message"}]},{"group":"Properties","pages":[{"title":"LocalCrossmintSDK","href":"/sdk-reference/wallets/kotlin/properties/local-crossmint-sdk"}]}]},{"group":"Crossmint Auth","pages":[{"group":"Typescript SDK","icon":"/images/icons/ts-logo-128.png","pages":[{"title":"Getting Started","href":"/sdk-reference/auth/typescript/overview"},{"title":"Reference","href":"/sdk-reference/auth/typescript/reference"},{"group":"Classes","pages":[{"title":"CrossmintAuth","href":"/sdk-reference/auth/typescript/classes/CrossmintAuth"},{"title":"CrossmintAuthenticationError","href":"/sdk-reference/auth/typescript/classes/CrossmintAuthenticationError"},{"title":"JwksUnavailableError","href":"/sdk-reference/auth/typescript/classes/JwksUnavailableError"}]},{"group":"Type Aliases","pages":[{"title":"CrossmintAuthServerOptions","href":"/sdk-reference/auth/typescript/type-aliases/CrossmintAuthServerOptions"},{"title":"GenericRequest","href":"/sdk-reference/auth/typescript/type-aliases/GenericRequest"},{"title":"GenericResponse","href":"/sdk-reference/auth/typescript/type-aliases/GenericResponse"},{"title":"JWKSInput","href":"/sdk-reference/auth/typescript/type-aliases/JWKSInput"},{"title":"SDKExternalUser","href":"/sdk-reference/auth/typescript/type-aliases/SDKExternalUser"},{"title":"VerifyCrossmintJwtOptions","href":"/sdk-reference/auth/typescript/type-aliases/VerifyCrossmintJwtOptions"}]},{"group":"Variables","pages":[{"title":"CROSSMINT_API_VERSION","href":"/sdk-reference/auth/typescript/variables/CROSSMINT_API_VERSION"},{"title":"SDK_NAME","href":"/sdk-reference/auth/typescript/variables/SDK_NAME"},{"title":"SDK_VERSION","href":"/sdk-reference/auth/typescript/variables/SDK_VERSION"}]},{"group":"Functions","pages":[{"title":"assertJwtAudience","href":"/sdk-reference/auth/typescript/functions/assertJwtAudience"},{"title":"createCrossmint","href":"/sdk-reference/auth/typescript/functions/createCrossmint"},{"title":"getAuthCookieNames","href":"/sdk-reference/auth/typescript/functions/getAuthCookieNames"},{"title":"validateAPIKey","href":"/sdk-reference/auth/typescript/functions/validateAPIKey"},{"title":"verifyCrossmintJwt","href":"/sdk-reference/auth/typescript/functions/verifyCrossmintJwt"}]}]},{"group":"React SDK","icon":"/images/icons/react.svg","pages":[{"title":"Get Started","href":"/sdk-reference/auth/react/get-started"},{"title":"Providers","href":"/sdk-reference/auth/react/providers"},{"title":"Hooks","href":"/sdk-reference/auth/react/hooks"},{"title":"Components","href":"/sdk-reference/auth/react/components"}]},{"group":"React Native SDK","icon":"/images/icons/react-native.svg","pages":[{"title":"Get Started","href":"/sdk-reference/auth/react-native/get-started"},{"title":"Providers","href":"/sdk-reference/auth/react-native/providers"},{"title":"Hooks","href":"/sdk-reference/auth/react-native/hooks"}]}]}]}]},{"tab":"Identity","pages":[{"title":"Identity","href":"/identity/overview"}]},{"tab":"Stablecoin Orchestration","pages":[{"title":"Stablecoin Orchestration","href":"/stablecoin-orchestration/overview"}]},{"tab":"Checkout","pages":[{"title":"Checkout","href":"/payments/introduction"}]},{"tab":"Onramp","pages":[{"title":"Onramp","href":"/onramp/overview"}]},{"tab":"Offramp","pages":[{"title":"Offramp","href":"/offramp/overview"}]},{"tab":"Agents","pages":[{"title":"Agents","href":"/agents/overview"}]},{"tab":"Others","menu":[{"item":"Tokenization","pages":[{"title":"Tokenization","href":"/tokenization/introduction"}]}],"pages":[{"title":"Others","href":"/tokenization/introduction"}]}]},"basePath":"","title":"Cloud KMS Signers - Crossmint Docs","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DTFzvaXJ.js","lightbox-handle-r17bVUz3.js"]}