API Playground
Interactive testing environment for DSPIP protocol operations
Generate a new secp256k1 key pair for DSPIP signing operations. Returns both private and public keys.
{
"message": "Click 'Run' to generate a new key pair"
}
// Using @noble/secp256k1 import * as secp from '@noble/secp256k1'; // Generate random private key const privateKey = secp.utils.randomPrivateKey(); // Derive compressed public key const publicKey = secp.getPublicKey(privateKey, true); // Convert to hex strings const privateKeyHex = bytesToHex(privateKey); const publicKeyHex = bytesToHex(publicKey); // Base64 for DNS record const publicKeyBase64 = btoa( String.fromCharCode(...publicKey) );
# Using coincurve library from coincurve import PrivateKey import base64 # Generate new key pair private_key = PrivateKey() public_key = private_key.public_key # Get hex representations private_key_hex = private_key.to_hex() public_key_hex = public_key.format(True).hex() # Base64 for DNS record public_key_base64 = base64.b64encode( public_key.format(True) ).decode()
// Using go-ethereum/crypto import ( "crypto/ecdsa" "encoding/base64" "encoding/hex" "github.com/ethereum/go-ethereum/crypto" ) // Generate new key pair privateKey, _ := crypto.GenerateKey() publicKey := privateKey.PublicKey // Compress public key pubBytes := crypto.CompressPubkey(&publicKey) // Encode privHex := hex.EncodeToString( crypto.FromECDSA(privateKey)) pubBase64 := base64.StdEncoding.EncodeToString( pubBytes)
# Key generation is done client-side # For testing, use OpenSSL: # Generate private key openssl ecparam -name secp256k1 \ -genkey -noout -out private.pem # Extract public key openssl ec -in private.pem \ -pubout -out public.pem # Get hex format openssl ec -in private.pem \ -text -noout
{
"privateKey": "string (64 hex chars)",
"publicKey": {
"hex": "string (66 hex chars)",
"base64": "string (44 chars)"
},
"ethereumAddress": "string (optional)"
}
Derive the public key from a private key. Useful for verifying key pairs.
{
"message": "Enter a private key and click 'Run'"
}
Create a DSPIP payload structure and encode it to Base64.
{
"message": "Fill in the fields and click 'Run'"
}
Sign a DSPIP payload using ECDSA with SHA-256. Creates a DER-encoded signature.
{
"message": "Enter parameters and click 'Run'"
}
Generate complete DSPIP QR code data string from components.
{
"message": "Enter parameters and click 'Run'"
}
Parse a DSPIP QR code string into its components and decode the payload.
{
"message": "Enter QR data and click 'Run'"
}
Verify an ECDSA signature against a public key and message.
{
"message": "Enter parameters and click 'Run'"
}
Look up a DSPIP public key from DNS TXT records using DNS over HTTPS.
{
"message": "Enter key locator and click 'Run'"
}
Calculate the SHA-256 hash of input data. Used internally for signature creation.
{
"message": "Enter data and click 'Run'"
}
Encode or decode data using Base64. Used for payload encoding in DSPIP.
{
"message": "Enter data and click 'Encode' or 'Decode'"
}