Skip to content

Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:108

An Identity that can sign blobs.

protected new Secp256k1KeyIdentity(publicKey, _privateKey): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:229

Secp256k1PublicKey

Uint8Array

Secp256k1KeyIdentity

SignIdentity.constructor

protected _principal: Principal | undefined

Defined in: packages/core/src/agent/auth.ts:58

SignIdentity._principal


protected _privateKey: Uint8Array

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:231


_publicKey: Secp256k1PublicKey

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:227

getKeyPair(): KeyPair

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:249

Return a copy of the key pair.

KeyPair

KeyPair


getPrincipal(): Principal

Defined in: packages/core/src/agent/auth.ts:74

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

Principal

SignIdentity.getPrincipal


getPublicKey(): Required<PublicKey>

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:260

Return the public key.

Required<PublicKey>

Required

SignIdentity.getPublicKey


sign(data): Promise<Signature>

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:269

Signs a blob of data, with this identity’s private key.

Uint8Array

bytes to hash and sign with this identity’s secretKey, producing a signature

Promise<Signature>

signature

SignIdentity.sign


toJSON(): JsonableSecp256k1Identity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:241

Serialize this key to JSON-serializable object.

JsonableSecp256k1Identity

JsonableSecp256k1Identity


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.

HttpAgentRequest

internet computer request to transform

Promise<unknown>

SignIdentity.transformRequest


static fromJSON(json): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:151

string

Secp256k1KeyIdentity


static fromKeyPair(publicKey, privateKey): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:168

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

Uint8Array

Uint8Array

Uint8Array

Uint8Array

Secp256k1KeyIdentity

Secp256k1KeyIdentity


static fromParsedJson(obj): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:143

JsonableSecp256k1Identity

Secp256k1KeyIdentity


static fromPem(pemKey): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:222

Utility method to create a Secp256k1KeyIdentity from a PEM-encoded key.

string

PEM-encoded key as a string

Secp256k1KeyIdentity

  • Secp256k1KeyIdentity

static fromSecretKey(secretKey): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:177

generates an identity from an existing secret key, and is the correct method to generate an identity from a seed phrase. Please ensure you protect the user’s private key.

Uint8Array

Uint8Array

Secp256k1KeyIdentity

  • Secp256k1KeyIdentity

static fromSeedPhrase(seedPhrase, password?): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:189

Generates an identity from a seed phrase. Use carefully - seed phrases should only be used in secure contexts, and you should avoid having users copying and pasting seed phrases as much as possible.

string | string[]

either an array of words or a string of words separated by spaces.

string

optional password to be used by bip39

Secp256k1KeyIdentity

Secp256k1KeyIdentity


static generate(seed?): Secp256k1KeyIdentity

Defined in: packages/core/src/identity/secp256k1/secp256k1.ts:117

Generates an identity. If a seed is provided, the keys are generated from the seed according to BIP 0032. Otherwise, the key pair is randomly generated. This method throws an error in case the seed is not 32 bytes long or invalid for use as a private key.

Uint8Array<ArrayBufferLike>

the optional seed

Secp256k1KeyIdentity

Secp256k1KeyIdentity