Skip to content

AttributesIdentity

Defined in: packages/core/src/identity/identity/attributes.ts:50

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.

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 });

new AttributesIdentity(options): AttributesIdentity

Defined in: packages/core/src/identity/identity/attributes.ts:61

AttributesIdentityOptions

Configuration for the identity.

AttributesIdentity

getPrincipal(): Principal

Defined in: packages/core/src/identity/identity/attributes.ts:67

Get the principal represented by this identity. Normally should be a Principal.selfAuthenticating().

Principal

Identity.getPrincipal


transformRequest(request): Promise<unknown>

Defined in: packages/core/src/identity/identity/attributes.ts:71

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.

HttpAgentRequest

Promise<unknown>

Identity.transformRequest