KMIP signing
Use the optional Node.js package @vaultys/id-kmip to delegate signing for a type 0x01 Ed25519 person identity. The signing key stays with the KMIP provider. The identity uses the standard public ID format, so browser apps can verify its signatures with @vaultys/id alone.
Requirements
- Node.js 20 or later.
- A KMIP 2.1 endpoint that supports
Signwith PureEd25519. It must accept the bytes inDataand return a raw 64-byte signature. - An active Ed25519 private key with signing permission, its KMIP key ID, and the corresponding raw 32-byte public key. A secp256k1 key produces ECDSA signatures, which this identity cannot verify.
- A TLS client certificate and private key. If the endpoint uses a private CA, also supply its CA certificate.
Download vaultys-id-4.0.0.tgz and vaultys-id-kmip-0.1.0.tgz from the
VaultysID preview release
and install both archives in your Node.js app. To build the packages yourself,
follow the source installation steps.
Sign in Node.js
Load kmipOptions from your deployment configuration. Supply host, keyId, the raw signing publicKey, the client certificate as cert, and its private key as key. The port defaults to 5696. The optional ca contains the server's CA certificate.
import { VaultysId } from "@vaultys/id";
import { KMIPSigner, type KMIPSignerOptions } from "@vaultys/id-kmip";
export async function signMessage(
kmipOptions: KMIPSignerOptions,
encryptionSecretKey: Uint8Array,
message: Uint8Array,
) {
const identity = await VaultysId.fromSigner(
new KMIPSigner(kmipOptions),
encryptionSecretKey,
);
return { id: identity.id, signature: await identity.sign(message) };
}
encryptionSecretKey is a separate 32-byte X25519 secret. Generate it once with a cryptographically secure random generator and store it securely. To restore the same identity and DID, use the same signing public key, X25519 secret, and serialization version. Use .toVersion(0) if restoring a version 0 public identity.
Use VaultysId.fromSigner() to restore an externally signed identity. The getSecret() and IdManager profile and backup flows require an exportable signing secret.
Verify on a server or in a browser
Pass the serialized public ID, signature and original message as bytes. The verifier uses the signing public key from the ID and needs no KMIP credentials.
import { VaultysId } from "@vaultys/id";
export function verifyMessage(
id: Uint8Array,
message: Uint8Array,
signature: Uint8Array,
) {
return VaultysId.fromId(id).verify(message, signature);
}
The integration suite exercises signing and verification against a mock service over mutual TLS. To validate your HSM, run the two examples with its provisioned key and confirm that verification returns true.