Skip to content

Local keys

Local keys are stored within the Document Rails database and are available for usage by all organizations without any external services.

To create a local key, upload the PEM file containing the private key value using the API or the dashboard.

Examples

import { createKey, CertificateType, KeyType } from "@vaultie/document-rails";

const response = await createKey(
    client,
    accessToken,
    organizationId,
    {
        // Private key information (required).
        key: {
            type: KeyType.Local,
            // PEM string of the private key.
            pem: await readFile("./private.key", { encoding: "utf8" })
        },

        // Certificate information (optional).
        certificate: {
            type: CertificateType.Local,
            // PEM string of the certificate.
            pem: await readFile("./key.crt", { encoding: "utf8" })
        }

        // W3C credential issuer verification method (DID URL, optional).
        credential_issuer_vm: "did:web:example.com#key-1",

        // `iss` claim value for signed JWTs (optional).
        issuer: "https://example.com",

        // OID4VP client identifier prefix (optional).
        //
        // See OID4VP documentation for more information.
        oid4vp_client_id_prefix: "decentralized_identifier"
    }
);