Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:109
Ed25519KeyIdentity is an implementation of SignIdentity that uses Ed25519 keys. This class is used to sign and verify messages for an agent.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”
protected
new Ed25519KeyIdentity(publicKey
,privateKey
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:168
Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”privateKey
Section titled “privateKey”Uint8Array
Returns
Section titled “Returns”Ed25519KeyIdentity
Overrides
Section titled “Overrides”Properties
Section titled “Properties”_principal
Section titled “_principal”
protected
_principal:undefined
|Principal
Defined in: packages/agent/lib/esm/auth.d.ts:52
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”getKeyPair()
Section titled “getKeyPair()”getKeyPair():
KeyPair
Defined in: packages/identity/src/identity/ed25519.ts:184
Return a copy of the key pair.
Returns
Section titled “Returns”getPrincipal()
Section titled “getPrincipal()”getPrincipal():
Principal
Defined in: packages/agent/lib/esm/auth.d.ts:65
Get the principal represented by this identity. Normally should be a
Principal.selfAuthenticating()
.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”getPublicKey()
Section titled “getPublicKey()”getPublicKey():
Required
<PublicKey
>
Defined in: packages/identity/src/identity/ed25519.ts:194
Return the public key.
Returns
Section titled “Returns”Required
<PublicKey
>
Overrides
Section titled “Overrides”sign()
Section titled “sign()”sign(
challenge
):Promise
<Signature
>
Defined in: packages/identity/src/identity/ed25519.ts:202
Signs a blob of data, with this identity’s private key.
Parameters
Section titled “Parameters”challenge
Section titled “challenge”Uint8Array
challenge to sign with this identity’s secretKey, producing a signature
Returns
Section titled “Returns”Promise
<Signature
>
Overrides
Section titled “Overrides”toJSON()
Section titled “toJSON()”toJSON():
JsonnableEd25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:177
Serialize this key to JSON.
Returns
Section titled “Returns”JsonnableEd25519KeyIdentity
transformRequest()
Section titled “transformRequest()”transformRequest(
request
):Promise
<unknown
>
Defined in: packages/agent/lib/esm/auth.d.ts:72
Transform a request into a signed version of the request. This is done last after the transforms on the body of a request. The returned object can be anything, but must be serializable to CBOR.
Parameters
Section titled “Parameters”request
Section titled “request”internet computer request to transform
Returns
Section titled “Returns”Promise
<unknown
>
Inherited from
Section titled “Inherited from”fromJSON()
Section titled “fromJSON()”
static
fromJSON(json
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:143
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Ed25519KeyIdentity
fromKeyPair()
Section titled “fromKeyPair()”
static
fromKeyPair(publicKey
,privateKey
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:155
Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”Uint8Array
privateKey
Section titled “privateKey”Uint8Array
Returns
Section titled “Returns”Ed25519KeyIdentity
fromParsedJson()
Section titled “fromParsedJson()”
static
fromParsedJson(obj
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:135
Parameters
Section titled “Parameters”JsonnableEd25519KeyIdentity
Returns
Section titled “Returns”Ed25519KeyIdentity
fromSecretKey()
Section titled “fromSecretKey()”
static
fromSecretKey(secretKey
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:159
Parameters
Section titled “Parameters”secretKey
Section titled “secretKey”Uint8Array
Returns
Section titled “Returns”Ed25519KeyIdentity
generate()
Section titled “generate()”
static
generate(seed?
):Ed25519KeyIdentity
Defined in: packages/identity/src/identity/ed25519.ts:115
Generate a new Ed25519KeyIdentity.
Parameters
Section titled “Parameters”Uint8Array
<ArrayBufferLike
>
a 32-byte seed for the private key. If not provided, a random seed will be generated.
Returns
Section titled “Returns”Ed25519KeyIdentity
Ed25519KeyIdentity
verify()
Section titled “verify()”
static
verify(sig
,msg
,pk
):boolean
Defined in: packages/identity/src/identity/ed25519.ts:222
Verify
Parameters
Section titled “Parameters”signature to verify
string
| ArrayBuffer
| Uint8Array
<ArrayBufferLike
>
message to verify
string
| ArrayBuffer
| Uint8Array
<ArrayBufferLike
>
public key
string
| ArrayBuffer
| Uint8Array
<ArrayBufferLike
>
Returns
Section titled “Returns”boolean
- true if the signature is valid, false otherwise