How to use P-256 (secp256r1) keys for secure, passkey-compatible authorization in Swig.
Aspect | TypeScript | Rust |
---|---|---|
Key Generation | Uses @noble/curves/nist p256 | Uses OpenSSL EcKey with X9_62_PRIME256V1 |
Public Key Format | Auto-compressed via p256.getPublicKey(key, true) | Manual compression via PointConversionForm::COMPRESSED |
Signing Function | getSigningFnForSecp256r1PrivateKey() | Custom closure with sign_message() |
WebAuthn Support | Built-in passkey integration | Requires external WebAuthn library |
Testing Environment | LiteSVM for lightweight testing | SwigTestContext with full SVM |
Use Cases | Client-side apps, browsers, passkeys | Server-side, CLI tools, testing |