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
- React Native
- iOS
- Android
generateKey(keyRequest: KeyRequest): Promise<string>
func generateKey(request: KeyRequestBindingDto) throws -> String
fun `generateKey`(`request`: KeyRequestBindingDto): String
Parameters
- React Native
- iOS
- Android
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
}
public struct KeyRequestBindingDto {
public var organisationId: String
public var keyType: String // values from configuration
public var keyParams: [String: String] // values from configuration
public var name: String // provide a unique name for the key
public var storageType: String // values from configuration
public var storageParams: [String: String] // values from configuration
}
data class KeyRequestBindingDto (
var `organisationId`: String,
var `keyType`: String,
var `keyParams`: Map<String, String>,
var `name`: String,
var `storageType`: String,
var `storageParams`: Map<String, String>
)
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
- examples:
-
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.-
examples:
SECURE_ELEMENT
,INTERNAL
-
A wallet initialized with either Secure Enclave for iOS or Keystore for Android can use
SECURE_ELEMENT
as itsstorageType
when generating keys.
-
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.