Overview
Classes
Section titled “Classes”AttributesIdentity
Section titled “AttributesIdentity”Defined in: packages/core/src/identity/identity/attributes.ts:54
An Identity decorator that injects sender_info into the request body
before delegating to an inner identity for signing.
Because sender_info is part of the request content, it is included in the
representation-independent hash (requestIdOf) and covered by the sender’s
signature for call and query endpoints.
The IC does not hash sender_info for read_state requests, so the
decorator skips injection for that endpoint to avoid signature verification
failures on update-call polls.
Example
Section titled “Example”const inner = DelegationIdentity.fromDelegation(key, chain);const identity = new AttributesIdentity({ inner, attributes: { data: new Uint8Array([...]), signature: new Uint8Array([...]) }, signer: { canisterId: Principal.fromText('aaaaa-aa') },});const agent = HttpAgent.create({ identity });Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttributesIdentity(
options):AttributesIdentity
Defined in: packages/core/src/identity/identity/attributes.ts:65
Parameters
Section titled “Parameters”options
Section titled “options”Configuration for the identity.
Returns
Section titled “Returns”Methods
Section titled “Methods”getPrincipal()
Section titled “getPrincipal()”getPrincipal():
Principal
Defined in: packages/core/src/identity/identity/attributes.ts:71
Get the principal represented by this identity. Normally should be a
Principal.selfAuthenticating().
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”transformRequest()
Section titled “transformRequest()”transformRequest(
request):Promise<unknown>
Defined in: packages/core/src/identity/identity/attributes.ts:75
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”Returns
Section titled “Returns”Promise<unknown>
Implementation of
Section titled “Implementation of”CryptoError
Section titled “CryptoError”Defined in: packages/core/src/identity/identity/ecdsa.ts:13
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CryptoError(
message):CryptoError
Defined in: packages/core/src/identity/identity/ecdsa.ts:14
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”cause?
Section titled “cause?”
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Section titled “Inherited from”Error.cause
message
Section titled “message”
readonlymessage:string
Defined in: packages/core/src/identity/identity/ecdsa.ts:14
Inherited from
Section titled “Inherited from”Error.message
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Section titled “Inherited from”Error.name
stack?
Section titled “stack?”
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Section titled “Inherited from”Error.stack
stackTraceLimit
Section titled “stackTraceLimit”
staticstackTraceLimit:number
Defined in: node_modules/.pnpm/@types+node@25.5.0/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Section titled “Inherited from”Error.stackTraceLimit
Methods
Section titled “Methods”captureStackTrace()
Section titled “captureStackTrace()”
staticcaptureStackTrace(targetObject,constructorOpt?):void
Defined in: node_modules/.pnpm/@types+node@25.5.0/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};Error.captureStackTrace(myObject);myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() { b();}
function b() { c();}
function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error;}
a();Parameters
Section titled “Parameters”targetObject
Section titled “targetObject”object
constructorOpt?
Section titled “constructorOpt?”Function
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Error.captureStackTrace
prepareStackTrace()
Section titled “prepareStackTrace()”
staticprepareStackTrace(err,stackTraces):any
Defined in: node_modules/.pnpm/@types+node@25.5.0/node_modules/@types/node/globals.d.ts:55
Parameters
Section titled “Parameters”Error
stackTraces
Section titled “stackTraces”CallSite[]
Returns
Section titled “Returns”any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Section titled “Inherited from”Error.prepareStackTrace
Delegation
Section titled “Delegation”Defined in: packages/core/src/identity/identity/delegation.ts:42
A single delegation object that is signed by a private key. This is constructed by
DelegationChain.create().
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Delegation(
pubkey,expiration,targets?):Delegation
Defined in: packages/core/src/identity/identity/delegation.ts:43
Parameters
Section titled “Parameters”pubkey
Section titled “pubkey”Uint8Array
expiration
Section titled “expiration”bigint
targets?
Section titled “targets?”Returns
Section titled “Returns”Properties
Section titled “Properties”expiration
Section titled “expiration”
readonlyexpiration:bigint
Defined in: packages/core/src/identity/identity/delegation.ts:45
pubkey
Section titled “pubkey”
readonlypubkey:Uint8Array
Defined in: packages/core/src/identity/identity/delegation.ts:44
targets?
Section titled “targets?”
readonlyoptionaltargets?:Principal[]
Defined in: packages/core/src/identity/identity/delegation.ts:46
Methods
Section titled “Methods”toCborValue()
Section titled “toCborValue()”toCborValue():
object
Defined in: packages/core/src/identity/identity/delegation.ts:49
Returns a value that can be encoded with CBOR. Typically called in the replacer function of the encode function.
Returns
Section titled “Returns”object
expiration
Section titled “expiration”expiration:
bigint
pubkey
Section titled “pubkey”pubkey:
Uint8Array<ArrayBufferLike>
targets?
Section titled “targets?”
optionaltargets?:Principal[]
Implementation of
Section titled “Implementation of”toJSON()
Section titled “toJSON()”toJSON():
JsonnableDelegation
Defined in: packages/core/src/identity/identity/delegation.ts:59
Returns
Section titled “Returns”JsonnableDelegation
DelegationChain
Section titled “DelegationChain”Defined in: packages/core/src/identity/identity/delegation.ts:149
A chain of delegations. This is JSON Serializable. This is the object to serialize and pass to a DelegationIdentity. It does not keep any private keys.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”
protectednew DelegationChain(delegations,publicKey):DelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:243
Parameters
Section titled “Parameters”delegations
Section titled “delegations”publicKey
Section titled “publicKey”Returns
Section titled “Returns”Properties
Section titled “Properties”delegations
Section titled “delegations”
readonlydelegations:SignedDelegation[]
Defined in: packages/core/src/identity/identity/delegation.ts:244
publicKey
Section titled “publicKey”
readonlypublicKey:DerEncodedPublicKey
Defined in: packages/core/src/identity/identity/delegation.ts:245
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON():
JsonnableDelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:248
Returns
Section titled “Returns”create()
Section titled “create()”
staticcreate(from,to,expiration?,options?):Promise<DelegationChain>
Defined in: packages/core/src/identity/identity/delegation.ts:179
Create a delegation chain between two (or more) keys. By default, the expiration time will be very short (15 minutes).
To build a chain of more than 2 identities, this function needs to be called multiple times, passing the previous delegation chain into the options argument. For example:
Parameters
Section titled “Parameters”The identity that will delegate.
The identity that gets delegated. It can now sign messages as if it was the identity above.
expiration?
Section titled “expiration?”Date = ...
The length the delegation is valid. By default, 15 minutes from calling this function.
options?
Section titled “options?”A set of options for this delegation. expiration and previous
previous?
Section titled “previous?”Another DelegationChain that this chain should start with.
targets?
Section titled “targets?”targets that scope the delegation (e.g. Canister Principals)
Returns
Section titled “Returns”Promise<DelegationChain>
Example
Section titled “Example”const rootKey = createKey();const middleKey = createKey();const bottomeKey = createKey();
const rootToMiddle = await DelegationChain.create( root, middle.getPublicKey(), Date.parse('2100-01-01'),);const middleToBottom = await DelegationChain.create( middle, bottom.getPublicKey(), Date.parse('2100-01-01'), { previous: rootToMiddle },);
// We can now use a delegation identity that uses the delegation above:const identity = DelegationIdentity.fromDelegation(bottomKey, middleToBottom);fromDelegations()
Section titled “fromDelegations()”
staticfromDelegations(delegations,publicKey):DelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:236
Creates a DelegationChain object from a list of delegations and a DER-encoded public key.
Parameters
Section titled “Parameters”delegations
Section titled “delegations”The list of delegations.
publicKey
Section titled “publicKey”The DER-encoded public key of the key-pair signing the first delegation.
Returns
Section titled “Returns”fromJSON()
Section titled “fromJSON()”
staticfromJSON(json):DelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:199
Creates a DelegationChain object from a JSON string.
Parameters
Section titled “Parameters”string | JsonnableDelegationChain
The JSON string to parse.
Returns
Section titled “Returns”DelegationIdentity
Section titled “DelegationIdentity”Defined in: packages/core/src/identity/identity/delegation.ts:275
An Identity that adds delegation to a request. Everywhere in this class, the name innerKey refers to the SignIdentity that is being used to sign the requests, while originalKey is the identity that is being borrowed. More identities can be used in the middle to delegate.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”
protectednew DelegationIdentity(_inner,_delegation):DelegationIdentity
Defined in: packages/core/src/identity/identity/delegation.ts:288
Parameters
Section titled “Parameters”_inner
Section titled “_inner”Pick<SignIdentity, "sign">
_delegation
Section titled “_delegation”Returns
Section titled “Returns”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”getDelegation()
Section titled “getDelegation()”getDelegation():
DelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:295
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():
PublicKey
Defined in: packages/core/src/identity/identity/delegation.ts:299
Returns the public key that would match this identity’s signature.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”sign()
Section titled “sign()”sign(
blob):Promise<Signature>
Defined in: packages/core/src/identity/identity/delegation.ts:305
Signs a blob of data, with this identity’s private key.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”Promise<Signature>
Overrides
Section titled “Overrides”transformRequest()
Section titled “transformRequest()”transformRequest(
request):Promise<unknown>
Defined in: packages/core/src/identity/identity/delegation.ts:309
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>
Overrides
Section titled “Overrides”fromDelegation()
Section titled “fromDelegation()”
staticfromDelegation(key,delegation):DelegationIdentity
Defined in: packages/core/src/identity/identity/delegation.ts:281
Create a delegation without having access to delegateKey.
Parameters
Section titled “Parameters”Pick<SignIdentity, "sign">
The key used to sign the requests.
delegation
Section titled “delegation”A delegation object created using createDelegation.
Returns
Section titled “Returns”ECDSAKeyIdentity
Section titled “ECDSAKeyIdentity”Defined in: packages/core/src/identity/identity/ecdsa.ts:47
An identity interface that wraps an ECDSA keypair using the P-256 named curve. Supports DER-encoding and decoding for agent calls
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”
protectednew ECDSAKeyIdentity(keyPair,derKey,subtleCrypto):ECDSAKeyIdentity
Defined in: packages/core/src/identity/identity/ecdsa.ts:103
Parameters
Section titled “Parameters”keyPair
Section titled “keyPair”CryptoKeyPair
derKey
Section titled “derKey”subtleCrypto
Section titled “subtleCrypto”SubtleCrypto
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Properties
Section titled “Properties”_derKey
Section titled “_derKey”
protected_derKey:DerEncodedPublicKey
Defined in: packages/core/src/identity/identity/ecdsa.ts:98
_keyPair
Section titled “_keyPair”
protected_keyPair:CryptoKeyPair
Defined in: packages/core/src/identity/identity/ecdsa.ts:99
_principal
Section titled “_principal”
protected_principal:Principal|undefined
Defined in: packages/core/src/agent/auth.ts:58
Inherited from
Section titled “Inherited from”_subtleCrypto
Section titled “_subtleCrypto”
protected_subtleCrypto:SubtleCrypto
Defined in: packages/core/src/identity/identity/ecdsa.ts:100
Methods
Section titled “Methods”getKeyPair()
Section titled “getKeyPair()”getKeyPair():
CryptoKeyPair
Defined in: packages/core/src/identity/identity/ecdsa.ts:118
Return the internally-used key pair.
Returns
Section titled “Returns”CryptoKeyPair
a CryptoKeyPair
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():
PublicKey&DerCryptoKey
Defined in: packages/core/src/identity/identity/ecdsa.ts:126
Return the public key.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”sign()
Section titled “sign()”sign(
challenge):Promise<Signature>
Defined in: packages/core/src/identity/identity/ecdsa.ts:141
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>
signature
Overrides
Section titled “Overrides”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”fromKeyPair()
Section titled “fromKeyPair()”
staticfromKeyPair(keyPair,subtleCrypto?):Promise<ECDSAKeyIdentity>
Defined in: packages/core/src/identity/identity/ecdsa.ts:84
generates an identity from a public and private key. Please ensure that you are generating these keys securely and protect the user’s private key
Parameters
Section titled “Parameters”keyPair
Section titled “keyPair”CryptoKeyPair | { privateKey: CryptoKey; publicKey: CryptoKey; }
a CryptoKeyPair
subtleCrypto?
Section titled “subtleCrypto?”SubtleCrypto
a SubtleCrypto interface in case one is not available globally
Returns
Section titled “Returns”Promise<ECDSAKeyIdentity>
generate()
Section titled “generate()”
staticgenerate(options?):Promise<ECDSAKeyIdentity>
Defined in: packages/core/src/identity/identity/ecdsa.ts:56
Generates a randomly generated identity for use in calls to the Internet Computer.
Parameters
Section titled “Parameters”options?
Section titled “options?”optional settings
Returns
Section titled “Returns”Promise<ECDSAKeyIdentity>
Ed25519KeyIdentity
Section titled “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”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”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”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”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”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
verify()
Section titled “verify()”
staticverify(sig,msg,pk):boolean
Defined in: packages/core/src/identity/identity/ed25519.ts:229
Verify
Parameters
Section titled “Parameters”string | ArrayBuffer | Uint8Array<ArrayBufferLike>
signature to verify
string | ArrayBuffer | Uint8Array<ArrayBufferLike>
message to verify
string | ArrayBuffer | Uint8Array<ArrayBufferLike>
public key
Returns
Section titled “Returns”boolean
- true if the signature is valid, false otherwise
Ed25519PublicKey
Section titled “Ed25519PublicKey”Defined in: packages/core/src/identity/identity/ed25519.ts:21
A Public Key implementation.
Implements
Section titled “Implements”Accessors
Section titled “Accessors”derKey
Section titled “derKey”Get Signature
Section titled “Get Signature”get derKey():
DerEncodedPublicKey
Defined in: packages/core/src/identity/identity/ed25519.ts:90
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”rawKey
Section titled “rawKey”Get Signature
Section titled “Get Signature”get rawKey():
Uint8Array
Defined in: packages/core/src/identity/identity/ed25519.ts:84
Returns
Section titled “Returns”Uint8Array
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”toDer()
Section titled “toDer()”toDer():
DerEncodedPublicKey
Defined in: packages/core/src/identity/identity/ed25519.ts:103
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”toRaw()
Section titled “toRaw()”toRaw():
Uint8Array
Defined in: packages/core/src/identity/identity/ed25519.ts:107
Returns
Section titled “Returns”Uint8Array
Implementation of
Section titled “Implementation of”from()
Section titled “from()”
staticfrom(maybeKey):Ed25519PublicKey
Defined in: packages/core/src/identity/identity/ed25519.ts:27
Construct Ed25519PublicKey from an existing PublicKey
Parameters
Section titled “Parameters”maybeKey
Section titled “maybeKey”unknown
existing PublicKey, ArrayBuffer, DerEncodedPublicKey, or hex string
Returns
Section titled “Returns”Instance of Ed25519PublicKey
fromDer()
Section titled “fromDer()”
staticfromDer(derKey):Ed25519PublicKey
Defined in: packages/core/src/identity/identity/ed25519.ts:61
Parameters
Section titled “Parameters”derKey
Section titled “derKey”Returns
Section titled “Returns”fromRaw()
Section titled “fromRaw()”
staticfromRaw(rawKey):Ed25519PublicKey
Defined in: packages/core/src/identity/identity/ed25519.ts:57
Parameters
Section titled “Parameters”rawKey
Section titled “rawKey”Uint8Array
Returns
Section titled “Returns”PartialDelegationIdentity
Section titled “PartialDelegationIdentity”Defined in: packages/core/src/identity/identity/delegation.ts:329
A partial delegated identity, representing a delegation chain and the public key that it targets
Extends
Section titled “Extends”Accessors
Section titled “Accessors”delegation
Section titled “delegation”Get Signature
Section titled “Get Signature”get delegation():
DelegationChain
Defined in: packages/core/src/identity/identity/delegation.ts:335
The Delegation Chain of this identity.
Returns
Section titled “Returns”derKey
Section titled “derKey”Get Signature
Section titled “Get Signature”get derKey():
Uint8Array<ArrayBufferLike> |undefined
Defined in: packages/core/src/identity/identity/partial.ts:20
The DER-encoded public key of this identity.
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
Inherited from
Section titled “Inherited from”rawKey
Section titled “rawKey”Get Signature
Section titled “Get Signature”get rawKey():
Uint8Array<ArrayBufferLike> |undefined
Defined in: packages/core/src/identity/identity/partial.ts:13
The raw public key of this identity.
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”getPrincipal()
Section titled “getPrincipal()”getPrincipal():
Principal
Defined in: packages/core/src/identity/identity/partial.ts:41
The Principal of this identity.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”getPublicKey()
Section titled “getPublicKey()”getPublicKey():
PublicKey
Defined in: packages/core/src/identity/identity/partial.ts:34
The inner PublicKey used by this identity.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”toDer()
Section titled “toDer()”toDer():
Uint8Array
Defined in: packages/core/src/identity/identity/partial.ts:27
The DER-encoded public key of this identity.
Returns
Section titled “Returns”Uint8Array
Inherited from
Section titled “Inherited from”transformRequest()
Section titled “transformRequest()”transformRequest():
Promise<never>
Defined in: packages/core/src/identity/identity/partial.ts:51
Required for the Identity interface, but cannot implemented for just a public key.
Returns
Section titled “Returns”Promise<never>
Inherited from
Section titled “Inherited from”PartialIdentity.transformRequest
fromDelegation()
Section titled “fromDelegation()”
staticfromDelegation(key,delegation):PartialDelegationIdentity
Defined in: packages/core/src/identity/identity/delegation.ts:349
Create a PartialDelegationIdentity from a PublicKey and a DelegationChain.
Parameters
Section titled “Parameters”The PublicKey to delegate to.
delegation
Section titled “delegation”a DelegationChain targeting the inner key.
Returns
Section titled “Returns”PartialIdentity
Section titled “PartialIdentity”Defined in: packages/core/src/identity/identity/partial.ts:7
A partial delegated identity, representing a delegation chain and the public key that it targets
Extended by
Section titled “Extended by”Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PartialIdentity(
inner):PartialIdentity
Defined in: packages/core/src/identity/identity/partial.ts:57
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Accessors
Section titled “Accessors”derKey
Section titled “derKey”Get Signature
Section titled “Get Signature”get derKey():
Uint8Array<ArrayBufferLike> |undefined
Defined in: packages/core/src/identity/identity/partial.ts:20
The DER-encoded public key of this identity.
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
rawKey
Section titled “rawKey”Get Signature
Section titled “Get Signature”get rawKey():
Uint8Array<ArrayBufferLike> |undefined
Defined in: packages/core/src/identity/identity/partial.ts:13
The raw public key of this identity.
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
Methods
Section titled “Methods”getPrincipal()
Section titled “getPrincipal()”getPrincipal():
Principal
Defined in: packages/core/src/identity/identity/partial.ts:41
The Principal of this identity.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”getPublicKey()
Section titled “getPublicKey()”getPublicKey():
PublicKey
Defined in: packages/core/src/identity/identity/partial.ts:34
The inner PublicKey used by this identity.
Returns
Section titled “Returns”toDer()
Section titled “toDer()”toDer():
Uint8Array
Defined in: packages/core/src/identity/identity/partial.ts:27
The DER-encoded public key of this identity.
Returns
Section titled “Returns”Uint8Array
transformRequest()
Section titled “transformRequest()”transformRequest():
Promise<never>
Defined in: packages/core/src/identity/identity/partial.ts:51
Required for the Identity interface, but cannot implemented for just a public key.
Returns
Section titled “Returns”Promise<never>
Implementation of
Section titled “Implementation of”WebAuthnIdentity
Section titled “WebAuthnIdentity”Defined in: packages/core/src/identity/identity/webauthn.ts:137
A SignIdentity that uses navigator.credentials. See https://webauthn.guide/ for
more information about WebAuthentication.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebAuthnIdentity(
rawId,cose,authenticatorAttachment):WebAuthnIdentity
Defined in: packages/core/src/identity/identity/webauthn.ts:184
Parameters
Section titled “Parameters”Uint8Array
Uint8Array
authenticatorAttachment
Section titled “authenticatorAttachment”AuthenticatorAttachment | undefined
Returns
Section titled “Returns”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”_publicKey
Section titled “_publicKey”
protected_publicKey:CosePublicKey
Defined in: packages/core/src/identity/identity/webauthn.ts:182
authenticatorAttachment
Section titled “authenticatorAttachment”
protectedauthenticatorAttachment:AuthenticatorAttachment|undefined
Defined in: packages/core/src/identity/identity/webauthn.ts:187
readonlyrawId:Uint8Array
Defined in: packages/core/src/identity/identity/webauthn.ts:185
Methods
Section titled “Methods”getAuthenticatorAttachment()
Section titled “getAuthenticatorAttachment()”getAuthenticatorAttachment():
AuthenticatorAttachment|undefined
Defined in: packages/core/src/identity/identity/webauthn.ts:205
WebAuthn level 3 spec introduces a new attribute on successful WebAuthn interactions, see https://w3c.github.io/webauthn/#dom-publickeycredential-authenticatorattachment. This attribute is already implemented for Chrome, Safari and Edge.
Given the attribute is only available after a successful interaction, the information is
provided opportunistically and might also be undefined.
Returns
Section titled “Returns”AuthenticatorAttachment | undefined
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():
PublicKey
Defined in: packages/core/src/identity/identity/webauthn.ts:193
Returns the public key that would match this identity’s signature.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”sign()
Section titled “sign()”sign(
blob):Promise<Signature>
Defined in: packages/core/src/identity/identity/webauthn.ts:209
Signs a blob of data, with this identity’s private key.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”Promise<Signature>
Overrides
Section titled “Overrides”toJSON()
Section titled “toJSON()”toJSON():
JsonnableWebAuthnIdentity
Defined in: packages/core/src/identity/identity/webauthn.ts:249
Allow for JSON serialization of all information needed to reuse this identity.
Returns
Section titled “Returns”JsonnableWebAuthnIdentity
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”create()
Section titled “create()”
staticcreate(credentialCreationOptions?):Promise<WebAuthnIdentity>
Defined in: packages/core/src/identity/identity/webauthn.ts:156
Create an identity.
Parameters
Section titled “Parameters”credentialCreationOptions?
Section titled “credentialCreationOptions?”CredentialCreationOptions
an optional CredentialCreationOptions Challenge
Returns
Section titled “Returns”Promise<WebAuthnIdentity>
fromJSON()
Section titled “fromJSON()”
staticfromJSON(json):WebAuthnIdentity
Defined in: packages/core/src/identity/identity/webauthn.ts:142
Create an identity from a JSON serialization.
Parameters
Section titled “Parameters”string
json to parse
Returns
Section titled “Returns”Interfaces
Section titled “Interfaces”AttributesIdentityOptions
Section titled “AttributesIdentityOptions”Defined in: packages/core/src/identity/identity/attributes.ts:22
Options for creating an AttributesIdentity.
Properties
Section titled “Properties”attributes
Section titled “attributes”attributes:
SignedAttributes
Defined in: packages/core/src/identity/identity/attributes.ts:26
The signed attributes to include in the request.
inner:
Identity
Defined in: packages/core/src/identity/identity/attributes.ts:24
The inner identity to delegate signing to.
signer
Section titled “signer”signer:
Signer
Defined in: packages/core/src/identity/identity/attributes.ts:28
The canister that signed the attributes.
CryptoKeyOptions
Section titled “CryptoKeyOptions”Defined in: packages/core/src/identity/identity/ecdsa.ts:7
Options used in a ECDSAKeyIdentity
Properties
Section titled “Properties”extractable?
Section titled “extractable?”
optionalextractable?:boolean
Defined in: packages/core/src/identity/identity/ecdsa.ts:8
keyUsages?
Section titled “keyUsages?”
optionalkeyUsages?:KeyUsage[]
Defined in: packages/core/src/identity/identity/ecdsa.ts:9
subtleCrypto?
Section titled “subtleCrypto?”
optionalsubtleCrypto?:SubtleCrypto
Defined in: packages/core/src/identity/identity/ecdsa.ts:10
DelegationValidChecks
Section titled “DelegationValidChecks”Defined in: packages/core/src/identity/identity/delegation.ts:357
List of things to check for a delegation chain validity.
Properties
Section titled “Properties”scope?
Section titled “scope?”
optionalscope?:string|Principal| (string|Principal)[]
Defined in: packages/core/src/identity/identity/delegation.ts:361
Check that the scope is amongst the scopes that this delegation has access to.
DerCryptoKey
Section titled “DerCryptoKey”Defined in: packages/core/src/identity/identity/ecdsa.ts:20
Extends
Section titled “Extends”CryptoKey
Properties
Section titled “Properties”algorithm
Section titled “algorithm”
readonlyalgorithm:KeyAlgorithm
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts:8469
The read-only algorithm property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.
Inherited from
Section titled “Inherited from”CryptoKey.algorithm
extractable
Section titled “extractable”
readonlyextractable:boolean
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts:8475
The read-only extractable property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().
Inherited from
Section titled “Inherited from”CryptoKey.extractable
toDer: () =>
DerEncodedPublicKey
Defined in: packages/core/src/identity/identity/ecdsa.ts:21
Returns
Section titled “Returns”
readonlytype:KeyType
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts:8481
The read-only type property of the CryptoKey interface indicates which kind of key is represented by the object.
Inherited from
Section titled “Inherited from”CryptoKey.type
usages
Section titled “usages”
readonlyusages:KeyUsage[]
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts:8487
The read-only usages property of the CryptoKey interface indicates what can be done with the key.
Inherited from
Section titled “Inherited from”CryptoKey.usages
JsonnableDelegationChain
Section titled “JsonnableDelegationChain”Defined in: packages/core/src/identity/identity/delegation.ts:132
Properties
Section titled “Properties”delegations
Section titled “delegations”delegations:
object[]
Defined in: packages/core/src/identity/identity/delegation.ts:134
delegation
Section titled “delegation”delegation:
object
delegation.expiration
Section titled “delegation.expiration”expiration:
string
delegation.pubkey
Section titled “delegation.pubkey”pubkey:
string
delegation.targets?
Section titled “delegation.targets?”
optionaltargets?:string[]
signature
Section titled “signature”signature:
string
publicKey
Section titled “publicKey”publicKey:
string
Defined in: packages/core/src/identity/identity/delegation.ts:133
SignedAttributes
Section titled “SignedAttributes”Defined in: packages/core/src/identity/identity/attributes.ts:7
Signed attributes to be included as sender_info in the request content.
Properties
Section titled “Properties”data:
Uint8Array
Defined in: packages/core/src/identity/identity/attributes.ts:8
signature
Section titled “signature”signature:
Uint8Array
Defined in: packages/core/src/identity/identity/attributes.ts:9
SignedDelegation
Section titled “SignedDelegation”Defined in: packages/core/src/identity/identity/delegation.ts:92
A signed delegation, which lends its identity to the public key in the delegation
object. This is constructed by DelegationChain.create().
Properties
Section titled “Properties”delegation
Section titled “delegation”delegation:
Delegation
Defined in: packages/core/src/identity/identity/delegation.ts:93
signature
Section titled “signature”signature:
Signature
Defined in: packages/core/src/identity/identity/delegation.ts:94
Signer
Section titled “Signer”Defined in: packages/core/src/identity/identity/attributes.ts:15
The canister that signed the attributes.
Properties
Section titled “Properties”canisterId
Section titled “canisterId”canisterId:
Principal
Defined in: packages/core/src/identity/identity/attributes.ts:16
Type Aliases
Section titled “Type Aliases”JsonnableEd25519KeyIdentity
Section titled “JsonnableEd25519KeyIdentity”JsonnableEd25519KeyIdentity = [
PublicKeyHex,SecretKeyHex]
Defined in: packages/core/src/identity/identity/ed25519.ts:246
Functions
Section titled “Functions”isDelegationValid()
Section titled “isDelegationValid()”isDelegationValid(
chain,checks?):boolean
Defined in: packages/core/src/identity/identity/delegation.ts:370
Analyze a DelegationChain and validate that it’s valid, ie. not expired and apply to the scope.
Parameters
Section titled “Parameters”The chain to validate.
checks?
Section titled “checks?”Various checks to validate on the chain.
Returns
Section titled “Returns”boolean
References
Section titled “References”DER_COSE_OID
Section titled “DER_COSE_OID”Re-exports DER_COSE_OID
ED25519_OID
Section titled “ED25519_OID”Re-exports ED25519_OID
unwrapDER
Section titled “unwrapDER”Re-exports unwrapDER
wrapDER
Section titled “wrapDER”Re-exports wrapDER