diff --git a/ARCs/arc-0052.md b/ARCs/arc-0052.md index 7241af58c..e4d9605fe 100644 --- a/ARCs/arc-0052.md +++ b/ARCs/arc-0052.md @@ -76,8 +76,8 @@ This extension is **OPTIONAL** and separate from the current interface that hand interface Wallet { ... - keyGen(context: KeyContext, name: string): Promise; - sign(context: KeyContext, name: string, message: Uint8Array): Promise; + keyGen(context: KeyContext, account:number, keyIndex: number): Promise; + signData(context: KeyContext, account:number, keyIndex: number, message: Uint8Array): Promise; ... } ``` @@ -91,17 +91,15 @@ In order to derive a key, the wallet should lookup the different derivation path - **method name**: `keyGen` - **parameters**: - `context`: The context of the key to be generated - - `type` (optional): The type of key to be generated. Possible values are `p-256`, `ed25519` - - Default value: `ed25519` - - `options`(optional): - - `index`: The index of the key to be generated. If not provided, the wallet should derive the next key in the derivation path. - - `key-identifier`(optional): Optional parameter to give the key a rememberable name (i.e "my-did"). Note: this wouldn't be recoverable from the mnemonic. + - `account`: The account index to be used for key derivation. The value value should be hardened as per BIP44 + - `keyIndex`: The key index to be used for key derivation. + - **returns**: Byte array cointaing the public key, which is a point on the Ed25519 elliptic curve. The public key is encoded as compressed EC point: the y-coordinate, combined with the lowest bit (the parity) of the x-coordinate, making up 32 bytes. ###### Example ```ts -const identityKey: Uint8Array = await wallet.keyGen(KeyContext.Identity, "ed25519", { index: 0, key-identifier: "myGamingId" }) +const identityKey: Uint8Array = await wallet.keyGen(KeyContext.Identity, 0, 0) ``` ##### sign @@ -115,26 +113,15 @@ Signing operation that can be used to perform arbitrary signing operations in a - **parameters**: - `data`: The data to be signed - `context`: The context of the key to be used for signing + - `account`: The account index to be used for key derivation. The value value should be hardened as per BIP44 + - `keyIndex`: The key index to be used for key derivation. - `metadata`: Object to describe the type of data that is being signed. It should specify the encoding used (i.e msgpack, cbor, etc) and a schema so that the wallet can decode it to show the user. - `encoding`: The encoding used for the data - `schema`: The schema of the data in the form of a JSON schema - - `type`(optional): The key type to be used for signing. Possible values are `ecdsa-p256`, `ed25519` - - Default value: `ed25519` - **returns**: Byte array containing the signature. The signature is encoded as a 64-byte array (32 + 32 bytes). It holds a compressed point R + the integer s (confirming that the signer knows the msg and the privKey). + - Throws error if data doesn't match the schema -###### Example - -```ts -// Example -> sign auth challenge request with an Address Key - -const authChallenge: Uint8Array = await wallet.sign("my-auth-challenge", KeyContext.Address, { encoding: "cbor", schema: { type: "object", properties: { challenge: { type: "string" } } } }, "ed25519", { index: 0 }) - -``` - - -## Security Considerations -TBC ## Copyright Copyright and related rights waived via CCO. \ No newline at end of file