Local Keys
Local keys are generated and stored by the wallet as JWKs in the configured DB if persistence is enabled. This page covers generating a key, importing existing key material, and listing or deleting keys. The examples use http://localhost:7005 as the base URL.
See Key Management for how the wallet chooses a default key.
Generate a Key
Create a new key in the wallet's key store.
Endpoint: POST /wallet/{walletId}/keys/generate | API Reference
Example Request
curl -X POST http://localhost:7005/wallet/{walletId}/keys/generate \
-H 'Content-Type: application/json' \
-d '{ "keyType": "Ed25519" }'
Path Parameters
- walletId: String (required) - The wallet to add the key to. See Managing Wallets.
Body Parameters
- keyType: String (optional) - One of
Ed25519,secp256r1,secp256k1,RSA. Defaults toEd25519.
Example Response
{
"keyId": "UneoCeKrx7t0SBINBZQOaSCCzvhgpK8tRS3NEG4pCfU",
"keyType": "Ed25519"
}
Response Fields
- keyId: String - The new key's ID. Use it as
keyIdwhen receiving, presenting, or creating a DID. - keyType: String - The key type.
Import a Key
Import existing key material as a JWK.
Endpoint: POST /wallet/{walletId}/keys/import | API Reference
Example Request
curl -X POST http://localhost:7005/wallet/{walletId}/keys/import \
-H 'Content-Type: application/json' \
-d '{
"key": {
"type": "jwk",
"jwk": { "kty": "OKP", "crv": "Ed25519", "x": "...", "d": "..." }
}
}'
Path Parameters
- walletId: String (required) - The wallet to import the key into.
Body Parameters
- key: Object (required) - The serialized key.
typeisjwk, andjwkcarries the JWK (include the privatedcomponent for a signing key).
Example Response
{
"keyId": "UneoCeKrx7t0SBINBZQOaSCCzvhgpK8tRS3NEG4pCfU",
"keyType": "Ed25519"
}
List Keys
List the metadata of all keys across the wallet's key stores.
Endpoint: GET /wallet/{walletId}/keys | API Reference
Example Request
curl http://localhost:7005/wallet/{walletId}/keys
Path Parameters
- walletId: String (required) - The wallet whose keys you want to list.
Example Response
[
{ "keyId": "UneoCeKrx7t0SBINBZQOaSCCzvhgpK8tRS3NEG4pCfU", "keyType": "Ed25519" }
]
Get a Key
Fetch a single key's metadata.
Endpoint: GET /wallet/{walletId}/keys/{keyId} | API Reference
Example Request
curl http://localhost:7005/wallet/{walletId}/keys/{keyId}
Path Parameters
- walletId: String (required) - The wallet holding the key.
- keyId: String (required) - The key to fetch. Obtain it from list keys or the generate/import response.
Example Response
{ "keyId": "UneoCeKrx7t0SBINBZQOaSCCzvhgpK8tRS3NEG4pCfU", "keyType": "Ed25519" }
Delete a Key
Endpoint: DELETE /wallet/{walletId}/keys/{keyId} | API Reference
Example Request
curl -X DELETE http://localhost:7005/wallet/{walletId}/keys/{keyId}
Path Parameters
- walletId: String (required) - The wallet holding the key.
- keyId: String (required) - The key to delete.
Example Response
204 No Content on success, or 404 Not Found if the key doesn't exist.
Next Steps
- Create a DID from one of your keys.
- Receive a credential bound to a key.
