Skip to main content

Generate keys

Generates a cryptographic public/private key pair.

A key is required to make a DID (decentralized identifier), which is used to identify the wallet holder in agent-to-agent interaction.

Function

generateKey(keyRequest: KeyRequest): Promise<string>

Parameters

export interface KeyRequest {
organisationId: string;
keyType: string; // values from configuration
keyParams: Record<string, string>; // values from configuration
name: string; // provide a unique name for the key
storageType: string; // values from configuration
storageParams: Record<string, string>; // values from configuration
}

Fields

  • organisationId - Value from create organization.

  • keyType - (from configuration*) Specifies the cryptographic algorithm to be used with the key. Related guide: key algorithms.

    • examples: BBS_PLUS, EDDSA, ES256
  • keyParams - (from configuration*) Parameters passed with key algorithm. No parameters currently supported.

  • name - Assign the key a name; must be unique amongst other keys.

  • storageType - (from configuration*) The type of storage for the generated keys. See key storage for supported key storage types.

note

Since hardware-based keys are inextricably linked to the chip where they are stored, they are not exportable and cannot be backed up or transferred onto another device. Credentials signed by hardware-based keys are thus tied to one device.

  • storageParams - (from configuration*) Parameters passed with key storage. No parameters currently supported.

Return value

The keyId is returned as a string. This is the value used when specifying keys to create a DID.

The public/private key values are stored and are not visible through the software.