Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:115
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”
protectednew Ed25519KeyIdentity(publicKey,privateKey):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:175
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:Principal|undefined
Defined in: packages/core/src/agent/auth.ts:58
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”getKeyPair()
Section titled “getKeyPair()”getKeyPair():
KeyPair
Defined in: packages/core/src/identity/identity/ed25519.ts:191
Return a copy of the key pair.
Returns
Section titled “Returns”getPrincipal()
Section titled “getPrincipal()”getPrincipal():
Principal
Defined in: packages/core/src/agent/auth.ts:74
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/core/src/identity/identity/ed25519.ts:201
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/core/src/identity/identity/ed25519.ts:209
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/core/src/identity/identity/ed25519.ts:184
Serialize this key to JSON.
Returns
Section titled “Returns”transformRequest()
Section titled “transformRequest()”transformRequest(
request):Promise<unknown>
Defined in: packages/core/src/agent/auth.ts:87
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()”
staticfromJSON(json):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:151
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Ed25519KeyIdentity
fromKeyPair()
Section titled “fromKeyPair()”
staticfromKeyPair(publicKey,privateKey):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:162
Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”Uint8Array
privateKey
Section titled “privateKey”Uint8Array
Returns
Section titled “Returns”Ed25519KeyIdentity
fromParsedJson()
Section titled “fromParsedJson()”
staticfromParsedJson(obj):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:143
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Ed25519KeyIdentity
fromSecretKey()
Section titled “fromSecretKey()”
staticfromSecretKey(secretKey):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:166
Parameters
Section titled “Parameters”secretKey
Section titled “secretKey”Uint8Array
Returns
Section titled “Returns”Ed25519KeyIdentity
generate()
Section titled “generate()”
staticgenerate(seed?):Ed25519KeyIdentity
Defined in: packages/core/src/identity/identity/ed25519.ts:121
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()”
staticverify(sig,msg,pk):boolean
Defined in: packages/core/src/identity/identity/ed25519.ts:229
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