Skip to content

@auths-dev/sdk

Classes

ArtifactService

Signs artifacts (files or raw bytes) to produce verifiable attestations.

Access via Auths.artifacts.

Example

const result = auths.artifacts.sign({
  filePath: './release.tar.gz',
  identityDid: identity.did,
})
console.log(result.digest) // content hash

Constructors

Constructor
new ArtifactService(client): ArtifactService;
Parameters
client

Auths

Returns

ArtifactService

Methods

sign()
sign(opts): ArtifactResult;

Signs a file at the given path.

Parameters
opts

SignArtifactOptions

Signing options.

Returns

ArtifactResult

The artifact attestation with digest and metadata.

Throws

CryptoError if signing fails.

Example
const result = auths.artifacts.sign({
  filePath: './build/app.wasm',
  identityDid: identity.did,
  expiresInDays: 365,
})
signBytes()
signBytes(opts): ArtifactResult;

Signs raw bytes (e.g. an in-memory buffer).

Parameters
opts

SignArtifactBytesOptions

Signing options.

Returns

ArtifactResult

The artifact attestation with digest and metadata.

Throws

CryptoError if signing fails.

Example
const result = auths.artifacts.signBytes({
  data: Buffer.from('binary content'),
  identityDid: identity.did,
})

AttestationService

Queries attestations stored in the local registry.

Access via Auths.attestations.

Example

const atts = auths.attestations.list()
const latest = auths.attestations.getLatest(device.did)

Constructors

Constructor
new AttestationService(client): AttestationService;
Parameters
client

Auths

Returns

AttestationService

Methods

getLatest()
getLatest(deviceDid): AttestationInfo | null;

Retrieves the latest attestation for a device.

Parameters
deviceDid

string

DID of the device.

Returns

AttestationInfo | null

The latest attestation, or null if none found.

Throws

StorageError if the operation fails.

list()
list(): AttestationInfo[];

Lists all attestations in the local registry.

Returns

AttestationInfo[]

Array of attestation records.

Throws

StorageError if the operation fails.

listByDevice()
listByDevice(deviceDid): AttestationInfo[];

Lists attestations for a specific device.

Parameters
deviceDid

string

DID of the device to filter by.

Returns

AttestationInfo[]

Array of attestation records for the device.

Throws

StorageError if the operation fails.


AuditService

Audits Git repositories for commit signature compliance.

Access via Auths.audit.

Example

const report = auths.audit.report({ targetRepoPath: '/path/to/repo' })
console.log(report.summary.unsigned_commits)

Constructors

Constructor
new AuditService(client): AuditService;
Parameters
client

Auths

Returns

AuditService

Methods

isCompliant()
isCompliant(opts): boolean;

Checks whether all commits in a repository are signed.

Parameters
opts

AuditComplianceOptions

Compliance check options.

Returns

boolean

true if every commit is signed, false otherwise.

Example
if (auths.audit.isCompliant({ targetRepoPath: '/path/to/repo' })) {
  console.log('All commits signed')
}
report()
report(opts): AuditReport;

Generates an audit report for a Git repository's commit signatures.

Parameters
opts

AuditReportOptions

Audit options.

Returns

AuditReport

The audit report with per-commit details and summary statistics.

Throws

VerificationError if the audit fails.

Example
const report = auths.audit.report({ targetRepoPath: '/path/to/repo' })
console.log(report.summary.total_commits)

Auths

Primary entry point for all Auths SDK operations.

Provides access to identity management, device authorization, signing, verification, policy evaluation, organizations, and more through service properties.

Example

import { Auths } from '@auths-dev/node'

const auths = new Auths()

// Create an identity
const identity = auths.identities.create({ label: 'laptop' })

// Sign a message
const sig = auths.signAs({
  message: Buffer.from('hello world'),
  identityDid: identity.did,
})
console.log(sig.signature) // hex-encoded Ed25519 signature

Constructors

Constructor
new Auths(config?): Auths;

Creates a new Auths client.

Parameters
config?

ClientConfig = {}

Client configuration.

Returns

Auths

Example
// Auto-discover (~/.auths)
const auths = new Auths()

// Explicit configuration
const auths = new Auths({
  repoPath: '/path/to/identity-repo',
  passphrase: 'my-secret',
})

Properties

artifacts
readonly artifacts: ArtifactService;

Artifact signing.

attestations
readonly attestations: AttestationService;

Attestation queries.

audit
readonly audit: AuditService;

Repository audit reports.

commits
readonly commits: CommitService;

Git commit signing.

devices
readonly devices: DeviceService;

Device authorization (link, revoke, extend).

identities
readonly identities: IdentityService;

Identity management (create, rotate, delegate agents).

orgs
readonly orgs: OrgService;

Organization management.

pairing
readonly pairing: PairingService;

Cross-device pairing.

passphrase
readonly passphrase: string | undefined;

Passphrase for key operations, if set.

repoPath
readonly repoPath: string;

Path to the Auths Git registry.

signing
readonly signing: SigningService;

Message and action signing.

trust
readonly trust: TrustService;

Trust store for pinned identities.

witnesses
readonly witnesses: WitnessService;

Witness node management.

Methods

doctor()
doctor(): string;

Runs diagnostics on the Auths installation and returns a report.

Returns

string

A human-readable diagnostics string.

getPublicKey()
getPublicKey(opts): string;

Convenience method to get an identity's public key.

Parameters
opts

GetPublicKeyOptions

Lookup options.

Returns

string

Hex-encoded Ed25519 public key.

Throws

CryptoError if the key cannot be found.

signActionAs()
signActionAs(opts): ActionEnvelope;

Convenience method to sign an action as an identity.

Parameters
opts

SignActionAsIdentityOptions

Action signing options.

Returns

ActionEnvelope

The signed action envelope.

Throws

CryptoError if signing fails.

signActionAsAgent()
signActionAsAgent(opts): ActionEnvelope;

Convenience method to sign an action as an agent.

Parameters
opts

SignActionAsAgentOptions

Agent action signing options.

Returns

ActionEnvelope

The signed action envelope.

Throws

CryptoError if signing fails.

signAs()
signAs(opts): SignResult;

Convenience method to sign a message as an identity.

Parameters
opts

SignAsIdentityOptions

Signing options.

Returns

SignResult

The signature and signer DID.

Throws

CryptoError if signing fails.

Example
const result = auths.signAs({
  message: Buffer.from('hello world'),
  identityDid: identity.did,
})
signAsAgent()
signAsAgent(opts): SignResult;

Convenience method to sign a message as an agent.

Parameters
opts

SignAsAgentOptions

Agent signing options.

Returns

SignResult

The signature and signer DID.

Throws

CryptoError if signing fails.

verify()
verify(opts): Promise<VerificationResult>;

Verifies a single attestation with optional capability and time constraints.

Parameters
opts

VerifyOptions

Verification options.

Returns

Promise\<VerificationResult>

The verification result.

Throws

VerificationError if verification encounters an error.

Example
const result = await auths.verify({
  attestationJson: json,
  issuerKey: publicKeyHex,
})
console.log(result.valid)
verifyChain()
verifyChain(opts): Promise<VerificationReport>;

Verifies an attestation chain with optional capability and witness constraints.

Parameters
opts

VerifyChainOptions

Chain verification options.

Returns

Promise\<VerificationReport>

The verification report.

Throws

VerificationError if verification encounters an error.


AuthsError

Base error for all Auths SDK operations.

All errors thrown by the SDK inherit from this class, carrying a machine-readable code and human-readable message.

Example

import { Auths, AuthsError } from '@auths-dev/node'

try {
  auths.signAs({ message: data, identityDid: did })
} catch (e) {
  if (e instanceof AuthsError) {
    console.log(e.code, e.message)
  }
}

Extends

  • Error

Extended by

Constructors

Constructor
new AuthsError(message, code): AuthsError;
Parameters
message

string

code

string

Returns

AuthsError

Overrides
Error.constructor

Properties

cause?
optional cause: unknown;
Inherited from
Error.cause
code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
stack?
optional stack: string;
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;

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
Error.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
Error.prepareStackTrace

CommitService

Signs Git commits using Auths identities.

Access via Auths.commits.

Example

const result = auths.commits.sign({
  data: commitBuffer,
  identityDid: identity.did,
})
console.log(result.signaturePem) // PEM-encoded signature

Constructors

Constructor
new CommitService(client): CommitService;
Parameters
client

Auths

Returns

CommitService

Methods

sign()
sign(opts): CommitSignResult;

Signs raw Git commit data, producing a PEM-encoded signature.

Parameters
opts

SignCommitOptions

Signing options.

Returns

CommitSignResult

The commit signature with method and namespace metadata.

Throws

CryptoError if the key is missing or signing fails.

Example
const result = auths.commits.sign({
  data: Buffer.from(commitContent),
  identityDid: identity.did,
})

CryptoError

Raised when a cryptographic operation fails.

Common codes: 'invalid_key', 'key_not_found', 'signing_failed'.

Example

import { Auths, CryptoError } from '@auths-dev/node'

try {
  auths.signAs({ message: data, identityDid: did })
} catch (e) {
  if (e instanceof CryptoError && e.code === 'key_not_found') {
    console.log('Identity key not in keychain')
  }
}

Extends

Constructors

Constructor
new CryptoError(message, code): CryptoError;
Parameters
message

string

code

string

Returns

CryptoError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


DeviceService

Manages device authorization lifecycle: link, revoke, and extend.

Access via Auths.devices.

Example

const device = auths.devices.link({
  identityDid: identity.did,
  capabilities: ['sign'],
  expiresInDays: 90,
})

Constructors

Constructor
new DeviceService(client): DeviceService;
Parameters
client

Auths

Returns

DeviceService

Methods

extend()
extend(opts): DeviceExtension;

Extends a device's authorization period.

Parameters
opts

ExtendDeviceOptions

Extension options.

Returns

DeviceExtension

The extension result with new and previous expiration times.

Throws

IdentityError if extension fails.

Example
const ext = auths.devices.extend({
  deviceDid: device.did,
  identityDid: identity.did,
  days: 60,
})
console.log(ext.newExpiresAt) // RFC 3339 timestamp
link(opts): Device;

Links a new device to an identity with scoped capabilities.

Parameters
opts

LinkDeviceOptions

Link options.

Returns

Device

The linked device with its DID and attestation ID.

Throws

IdentityError if linking fails.

Example
const device = auths.devices.link({
  identityDid: identity.did,
  capabilities: ['sign'],
  expiresInDays: 90,
})
console.log(device.did) // did:key:z...
revoke()
revoke(opts): void;

Revokes a device's authorization under an identity.

Parameters
opts

RevokeDeviceOptions

Revocation options.

Returns

void

Throws

IdentityError if revocation fails.

Example
auths.devices.revoke({
  deviceDid: device.did,
  identityDid: identity.did,
  note: 'replaced',
})

IdentityError

Raised when an identity or device operation fails.

Common codes: 'identity_not_found', 'unknown'.

Example

import { Auths, IdentityError } from '@auths-dev/node'

try {
  auths.devices.link({ identityDid: did, capabilities: ['sign'] })
} catch (e) {
  if (e instanceof IdentityError) {
    console.log('Identity error:', e.code)
  }
}

Extends

Constructors

Constructor
new IdentityError(message, code): IdentityError;
Parameters
message

string

code

string

Returns

IdentityError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


IdentityService

Manages cryptographic identities, agents, and key rotation.

Access via Auths.identities.

Example

const auths = new Auths()
const identity = auths.identities.create({ label: 'laptop' })
console.log(identity.did) // did:keri:EBfd...

Constructors

Constructor
new IdentityService(client): IdentityService;
Parameters
client

Auths

Returns

IdentityService

Methods

create()
create(opts?): Identity;

Creates a new cryptographic identity backed by an Ed25519 keypair.

Parameters
opts?

CreateIdentityOptions = {}

Creation options.

Returns

Identity

The newly created identity.

Throws

IdentityError if the identity cannot be created.

Example
const identity = auths.identities.create({ label: 'laptop' })
console.log(identity.did)       // did:keri:EBfd...
console.log(identity.publicKey) // hex-encoded Ed25519 key
createAgent()
createAgent(opts): AgentIdentity;

Creates a standalone agent identity with a self-signed attestation.

Parameters
opts

CreateAgentOptions

Agent creation options.

Returns

AgentIdentity

The agent identity with its attestation.

Throws

IdentityError if the agent cannot be created.

Example
const agent = auths.identities.createAgent({
  name: 'ci-bot',
  capabilities: ['sign'],
})
console.log(agent.did) // did:keri:...
delegateAgent()
delegateAgent(opts): DelegatedAgent;

Delegates an agent under an existing identity with scoped capabilities.

Parameters
opts

DelegateAgentOptions

Delegation options.

Returns

DelegatedAgent

The delegated agent with its signed attestation.

Throws

IdentityError if delegation fails.

Example
const agent = auths.identities.delegateAgent({
  identityDid: identity.did,
  name: 'deploy-bot',
  capabilities: ['sign'],
  expiresInDays: 90,
})
getPublicKey()
getPublicKey(opts): string;

Retrieves the hex-encoded Ed25519 public key for an identity.

Parameters
opts

GetPublicKeyOptions

Lookup options.

Returns

string

Hex-encoded public key string (64 characters).

Throws

CryptoError if the key cannot be found.

Example
const pk = auths.identities.getPublicKey({ identityDid: identity.did })
console.log(pk.length) // 64
rotate()
rotate(opts?): RotationResult;

Rotates the signing keys for an identity, advancing the KERI event log.

Parameters
opts?

RotateKeysOptions = {}

Rotation options.

Returns

RotationResult

The rotation result with old and new key fingerprints.

Throws

IdentityError if rotation fails.

Example
const result = auths.identities.rotate({ identityDid: identity.did })
console.log(result.sequence) // incremented sequence number

KeychainError

Raised when the platform keychain is inaccessible or locked.

Common codes: 'keychain_locked'.

Example

import { Auths, KeychainError } from '@auths-dev/node'

try {
  auths.identities.create({ label: 'main' })
} catch (e) {
  if (e instanceof KeychainError) {
    console.log('Unlock your keychain or set AUTHS_KEYCHAIN_BACKEND=file')
  }
}

Extends

Constructors

Constructor
new KeychainError(message, code): KeychainError;
Parameters
message

string

code

string

Returns

KeychainError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


NetworkError

Raised when a network operation fails (e.g. witness communication).

Common codes: 'server_error'.

Example

import { NetworkError } from '@auths-dev/node'

try {
  // network operation
} catch (e) {
  if (e instanceof NetworkError && e.shouldRetry) {
    // safe to retry
  }
}

Extends

Constructors

Constructor
new NetworkError(
   message,
   code,
   shouldRetry?): NetworkError;
Parameters
message

string

code

string

shouldRetry?

boolean = true

Returns

NetworkError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

shouldRetry
shouldRetry: boolean;

Whether the operation is safe to retry. Defaults to true.

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


OrgError

Raised when an organization operation fails.

Common codes: 'org_error'.

Example

import { Auths, OrgError } from '@auths-dev/node'

try {
  auths.orgs.addMember({ orgDid, memberDid, role: 'member' })
} catch (e) {
  if (e instanceof OrgError) {
    console.log('Org error:', e.message)
  }
}

Extends

Constructors

Constructor
new OrgError(message, code): OrgError;
Parameters
message

string

code

string

Returns

OrgError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


OrgService

Manages organizations and their membership.

Access via Auths.orgs.

Example

const org = auths.orgs.create({ label: 'my-team' })
auths.orgs.addMember({
  orgDid: org.orgDid,
  memberDid: dev.did,
  role: 'member',
  memberPublicKeyHex: dev.publicKey,
})

Constructors

Constructor
new OrgService(client): OrgService;
Parameters
client

Auths

Returns

OrgService

Methods

addMember()
addMember(opts): OrgMember;

Adds a member to an organization.

Parameters
opts

AddOrgMemberOptions

Member options.

Returns

OrgMember

The new member record.

Throws

OrgError if the operation fails.

Example
const member = auths.orgs.addMember({
  orgDid: org.orgDid,
  memberDid: dev.did,
  role: 'member',
  memberPublicKeyHex: dev.publicKey,
})
create()
create(opts): OrgResult;

Creates a new organization.

Parameters
opts

CreateOrgOptions

Organization options.

Returns

OrgResult

The created organization.

Throws

OrgError if creation fails.

Example
const org = auths.orgs.create({ label: 'engineering' })
console.log(org.orgDid) // did:keri:...
listMembers()
listMembers(opts): OrgMember[];

Lists members of an organization.

Parameters
opts

ListOrgMembersOptions

List options.

Returns

OrgMember[]

Array of member records.

Throws

OrgError if the operation fails.

Example
const members = auths.orgs.listMembers({ orgDid: org.orgDid })
console.log(members.length)
revokeMember()
revokeMember(opts): OrgMember;

Revokes a member's access to an organization.

Parameters
opts

RevokeOrgMemberOptions

Revocation options.

Returns

OrgMember

The updated member record with revoked: true.

Throws

OrgError if the operation fails.


PairingError

Raised when a device pairing operation fails or times out.

Common codes: 'pairing_error', 'timeout'.

Example

import { PairingError } from '@auths-dev/node'

try {
  await auths.pairing.createSession({ bindAddress: '127.0.0.1' })
} catch (e) {
  if (e instanceof PairingError && e.shouldRetry) {
    // safe to retry
  }
}

Extends

Constructors

Constructor
new PairingError(
   message,
   code,
   shouldRetry?): PairingError;
Parameters
message

string

code

string

shouldRetry?

boolean = true

Returns

PairingError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

shouldRetry
shouldRetry: boolean;

Whether the operation is safe to retry. Defaults to true.

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


PairingService

Handles device pairing for cross-device identity authorization.

The pairing flow: controller creates a session, device joins with the short code, controller completes pairing to authorize the device.

Access via Auths.pairing.

Example

const session = await auths.pairing.createSession({
  bindAddress: '127.0.0.1',
  capabilities: ['sign:commit'],
})
console.log(session.shortCode) // e.g. 'A3F7K2'

// On the device side:
const response = await auths.pairing.join({
  shortCode: 'A3F7K2',
  endpoint: session.endpoint,
  token: session.token,
})

Constructors

Constructor
new PairingService(client): PairingService;
Parameters
client

Auths

Returns

PairingService

Methods

[asyncDispose]()
asyncDispose: Promise<void>;
Returns

Promise\<void>

[dispose]()
dispose: void;
Returns

void

complete()
complete(opts): Promise<PairingResult>;

Completes pairing by authorizing the connected device.

Parameters
opts

CompletePairingOptions

Completion options with device identity and capabilities.

Returns

Promise\<PairingResult>

The pairing result with the device's authorization attestation.

Throws

PairingError if no session is active or completion fails.

createSession()
createSession(opts?): Promise<PairingSession>;

Creates a pairing session and starts listening for device connections.

Parameters
opts?

CreatePairingSessionOptions

Session options.

Returns

Promise\<PairingSession>

The active pairing session with its short code and endpoint.

Throws

PairingError if session creation fails.

Example
const session = await auths.pairing.createSession({
  bindAddress: '127.0.0.1',
  enableMdns: false,
})
console.log(session.shortCode) // 6-char code
join()
join(opts): Promise<PairingResponse>;

Joins an existing pairing session from the device side.

Parameters
opts

JoinPairingOptions

Join options with short code and endpoint from the controller.

Returns

Promise\<PairingResponse>

The pairing response with device identity information.

Throws

PairingError if joining fails.

Example
const response = await auths.pairing.join({
  shortCode: 'A3F7K2',
  endpoint: 'http://127.0.0.1:8080',
  token: sessionToken,
})
stop()
stop(): Promise<void>;

Stops the active pairing session. Idempotent — safe to call multiple times.

Returns

Promise\<void>

Throws

PairingError if stopping the session fails.

waitForResponse()
waitForResponse(opts?): Promise<PairingResponse>;

Waits for a device to connect to the active pairing session.

Parameters
opts?

WaitForPairingResponseOptions

Wait options.

Returns

Promise\<PairingResponse>

The connecting device's information.

Throws

PairingError if no session is active or timeout is reached.


PolicyBuilder

Fluent builder for composing authorization policies.

Policies are built by chaining predicates, then compiled and evaluated against an attestation context to produce an allow/deny decision.

Example

import { PolicyBuilder } from '@auths-dev/node'

// Quick standard policy
const policy = PolicyBuilder.standard('sign_commit')
const decision = policy.evaluate({
  issuer: 'did:keri:EOrg',
  subject: 'did:key:zDevice',
  capabilities: ['sign_commit'],
})
console.log(decision.allowed) // true

// Complex composed policy
const ciPolicy = new PolicyBuilder()
  .notRevoked()
  .notExpired()
  .requireCapability('sign')
  .requireAgent()
  .requireRepo('org/repo')
  .build()

Constructors

Constructor
new PolicyBuilder(): PolicyBuilder;
Returns

PolicyBuilder

Methods

attrEquals()
attrEquals(key, value): PolicyBuilder;

Requires an attestation attribute to equal a specific value.

Parameters
key

string

Attribute key.

value

string

Required attribute value.

Returns

PolicyBuilder

attrIn()
attrIn(key, values): PolicyBuilder;

Requires an attestation attribute to be one of the given values.

Parameters
key

string

Attribute key.

values

string[]

Acceptable attribute values.

Returns

PolicyBuilder

build()
build(): string;

Compiles the policy for evaluation using the native policy engine.

Returns

string

Compiled policy JSON string.

Throws

AuthsError if compilation fails.

Throws

Error if the policy has no predicates.

evaluate()
evaluate(context): PolicyDecision;

Builds and evaluates the policy against a context in one step.

Parameters
context

EvalContextOpts

The evaluation context.

Returns

PolicyDecision

The policy decision.

Throws

AuthsError if compilation or evaluation fails.

Example
const decision = PolicyBuilder.standard('sign').evaluate({
  issuer: 'did:keri:EOrg',
  subject: 'did:key:zDevice',
  capabilities: ['sign'],
})
console.log(decision.allowed) // true
expiresAfter()
expiresAfter(seconds): PolicyBuilder;

Requires the attestation to expire after the given number of seconds from now.

Parameters
seconds

number

Minimum remaining lifetime in seconds.

Returns

PolicyBuilder

issuedWithin()
issuedWithin(seconds): PolicyBuilder;

Requires the attestation to have been issued within the given time window.

Parameters
seconds

number

Maximum age in seconds.

Returns

PolicyBuilder

maxChainDepth()
maxChainDepth(depth): PolicyBuilder;

Limits the maximum attestation chain depth.

Parameters
depth

number

Maximum allowed chain depth.

Returns

PolicyBuilder

negate()
negate(): PolicyBuilder;

Negates this policy — passes when the original would deny, and vice versa.

Returns

PolicyBuilder

A new negated builder.

notExpired()
notExpired(): PolicyBuilder;

Requires the attestation to not be expired.

Returns

PolicyBuilder

notRevoked()
notRevoked(): PolicyBuilder;

Requires the attestation to not be revoked.

Returns

PolicyBuilder

orPolicy()
orPolicy(other): PolicyBuilder;

Combines this policy with another using OR logic.

Parameters
other

PolicyBuilder

The other policy builder.

Returns

PolicyBuilder

A new builder that passes if either policy passes.

pathAllowed()
pathAllowed(patterns): PolicyBuilder;

Restricts allowed file paths.

Parameters
patterns

string[]

Glob patterns for allowed paths.

Returns

PolicyBuilder

refMatches()
refMatches(pattern): PolicyBuilder;

Requires the Git ref to match a pattern.

Parameters
pattern

string

Ref pattern (e.g. 'refs/heads/main').

Returns

PolicyBuilder

requireAgent()
requireAgent(): PolicyBuilder;

Requires the signer to be an agent.

Returns

PolicyBuilder

requireAllCapabilities()
requireAllCapabilities(caps): PolicyBuilder;

Requires the subject to hold all of the given capabilities.

Parameters
caps

string[]

Array of required capability strings.

Returns

PolicyBuilder

requireAnyCapability()
requireAnyCapability(caps): PolicyBuilder;

Requires the subject to hold at least one of the given capabilities.

Parameters
caps

string[]

Array of acceptable capability strings.

Returns

PolicyBuilder

requireCapability()
requireCapability(cap): PolicyBuilder;

Requires the subject to hold a specific capability.

Parameters
cap

string

Capability string (e.g. 'sign', 'sign_commit').

Returns

PolicyBuilder

requireDelegatedBy()
requireDelegatedBy(did): PolicyBuilder;

Requires the attestation to have been delegated by a specific identity.

Parameters
did

string

DID of the required delegator.

Returns

PolicyBuilder

requireEnv()
requireEnv(env): PolicyBuilder;

Requires a specific deployment environment.

Parameters
env

string

Environment name (e.g. 'production').

Returns

PolicyBuilder

requireEnvIn()
requireEnvIn(envs): PolicyBuilder;

Requires one of the given deployment environments.

Parameters
envs

string[]

Acceptable environment names.

Returns

PolicyBuilder

requireHuman()
requireHuman(): PolicyBuilder;

Requires the signer to be a human.

Returns

PolicyBuilder

requireIssuer()
requireIssuer(did): PolicyBuilder;

Requires the issuer to match a specific DID.

Parameters
did

string

Required issuer DID.

Returns

PolicyBuilder

requireIssuerIn()
requireIssuerIn(dids): PolicyBuilder;

Requires the issuer to be one of the given DIDs.

Parameters
dids

string[]

Acceptable issuer DIDs.

Returns

PolicyBuilder

requireRepo()
requireRepo(repo): PolicyBuilder;

Requires the operation to target a specific repository.

Parameters
repo

string

Repository identifier (e.g. 'org/repo').

Returns

PolicyBuilder

requireRepoIn()
requireRepoIn(repos): PolicyBuilder;

Requires the operation to target one of the given repositories.

Parameters
repos

string[]

Acceptable repository identifiers.

Returns

PolicyBuilder

requireSubject()
requireSubject(did): PolicyBuilder;

Requires the subject to match a specific DID.

Parameters
did

string

Required subject DID.

Returns

PolicyBuilder

requireWorkload()
requireWorkload(): PolicyBuilder;

Requires the signer to be a workload identity.

Returns

PolicyBuilder

toJson()
toJson(): string;

Serializes the policy to JSON without compiling.

Returns

string

JSON string representation of the policy expression.

Throws

Error if the policy has no predicates.

workloadClaimEquals()
workloadClaimEquals(key, value): PolicyBuilder;

Requires a workload attestation claim to equal a specific value.

Parameters
key

string

Claim key.

value

string

Required claim value.

Returns

PolicyBuilder

workloadIssuerIs()
workloadIssuerIs(did): PolicyBuilder;

Requires the workload attestation issuer to match a specific DID.

Parameters
did

string

Required workload issuer DID.

Returns

PolicyBuilder

anyOf()
static anyOf(...builders): PolicyBuilder;

Creates a policy that passes if any of the given policies pass.

Parameters
builders

...PolicyBuilder[]

Policies to OR together.

Returns

PolicyBuilder

A new builder combining the policies.

standard()
static standard(capability): PolicyBuilder;

Creates a standard policy requiring not-revoked, not-expired, and a capability.

Parameters
capability

string

Required capability string.

Returns

PolicyBuilder

A new builder with the standard predicates.

Example
const policy = PolicyBuilder.standard('sign_commit')

SigningService

Signs messages and actions using identity or agent keys.

Access via Auths.signing.

Example

const result = auths.signing.signAsIdentity({
  message: Buffer.from('hello world'),
  identityDid: identity.did,
})
console.log(result.signature) // hex-encoded Ed25519 signature

Constructors

Constructor
new SigningService(client): SigningService;
Parameters
client

Auths

Returns

SigningService

Methods

signActionAsAgent()
signActionAsAgent(opts): ActionEnvelope;

Signs a structured action as an agent.

Parameters
opts

SignActionAsAgentOptions

Agent action signing options.

Returns

ActionEnvelope

The signed action envelope.

Throws

CryptoError if signing fails.

Example
const envelope = auths.signing.signActionAsAgent({
  actionType: 'tool_call',
  payloadJson: '{"tool":"execute"}',
  keyAlias: agent.keyAlias,
  agentDid: agent.did,
})
signActionAsIdentity()
signActionAsIdentity(opts): ActionEnvelope;

Signs a structured action as an identity, producing a verifiable envelope.

Parameters
opts

SignActionAsIdentityOptions

Action signing options.

Returns

ActionEnvelope

The signed action envelope.

Throws

CryptoError if signing fails.

Example
const envelope = auths.signing.signActionAsIdentity({
  actionType: 'tool_call',
  payloadJson: '{"tool":"read_file"}',
  identityDid: identity.did,
})
signAsAgent()
signAsAgent(opts): SignResult;

Signs a message as an agent using its keychain alias.

Parameters
opts

SignAsAgentOptions

Agent signing options.

Returns

SignResult

The signature and signer DID.

Throws

CryptoError if the key is missing or signing fails.

Example
const result = auths.signing.signAsAgent({
  message: Buffer.from('payload'),
  keyAlias: agent.keyAlias,
})
signAsIdentity()
signAsIdentity(opts): SignResult;

Signs a message as an identity.

Parameters
opts

SignAsIdentityOptions

Signing options.

Returns

SignResult

The signature and signer DID.

Throws

CryptoError if the key is missing or signing fails.

Example
const result = auths.signing.signAsIdentity({
  message: Buffer.from('hello'),
  identityDid: identity.did,
})

StorageError

Raised when a storage or registry operation fails.

Common codes: 'repo_not_found', 'trust_error', 'witness_error'.

Example

import { Auths, StorageError } from '@auths-dev/node'

try {
  auths.trust.pin({ did: 'did:keri:ENOTREAL' })
} catch (e) {
  if (e instanceof StorageError) {
    console.log('Storage error:', e.message)
  }
}

Extends

Constructors

Constructor
new StorageError(message, code): StorageError;
Parameters
message

string

code

string

Returns

StorageError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


TrustService

Manages the local trust store for pinning and querying trusted identities.

Access via Auths.trust.

Example

auths.trust.pin({ did: peer.did, label: 'alice' })
const entries = auths.trust.list()

Constructors

Constructor
new TrustService(client): TrustService;
Parameters
client

Auths

Returns

TrustService

Methods

get()
get(did): PinnedIdentity | null;

Looks up a specific pinned identity by DID.

Parameters
did

string

DID to look up.

Returns

PinnedIdentity | null

The pinned identity entry, or null if not found.

Throws

StorageError if the operation fails.

Example
const entry = auths.trust.get('did:keri:EBfd...')
if (entry) console.log(entry.label)
list()
list(): PinnedIdentity[];

Lists all pinned identities in the local trust store.

Returns

PinnedIdentity[]

Array of pinned identity entries.

Throws

StorageError if the operation fails.

pin()
pin(opts): PinnedIdentity;

Pins an identity as trusted in the local store.

Parameters
opts

PinIdentityOptions

Pin options.

Returns

PinnedIdentity

The pinned identity entry.

Throws

StorageError if the pin operation fails.

Example
const entry = auths.trust.pin({ did: identity.did, label: 'my-peer' })
console.log(entry.trustLevel) // 'tofu'
remove()
remove(did): void;

Removes a pinned identity from the local trust store.

Parameters
did

string

DID of the identity to unpin.

Returns

void

Throws

StorageError if the operation fails.


VerificationError

Raised when attestation or chain verification fails.

Common codes: 'invalid_signature', 'expired_attestation', 'revoked_device', 'missing_capability'.

Example

import { verifyAttestation, VerificationError } from '@auths-dev/node'

try {
  await verifyAttestation(json, publicKey)
} catch (e) {
  if (e instanceof VerificationError) {
    console.log('Verification failed:', e.code)
  }
}

Extends

Constructors

Constructor
new VerificationError(message, code): VerificationError;
Parameters
message

string

code

string

Returns

VerificationError

Overrides

AuthsError.constructor

Properties

cause?
optional cause: unknown;
Inherited from

AuthsError.cause

code
code: string;

Machine-readable error code (e.g. 'key_not_found', 'invalid_signature').

Inherited from

AuthsError.code

message
message: string;
Inherited from

AuthsError.message

name
name: string;
Inherited from

AuthsError.name

stack?
optional stack: string;
Inherited from

AuthsError.stack

stackTraceLimit
static stackTraceLimit: number;

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

AuthsError.stackTraceLimit

Methods

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;

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
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

AuthsError.captureStackTrace

prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

AuthsError.prepareStackTrace


WitnessService

Manages witness nodes for receipt-based verification.

Access via Auths.witnesses.

Example

auths.witnesses.add({ url: 'http://witness.example.com:3333' })
const witnesses = auths.witnesses.list()

Constructors

Constructor
new WitnessService(client): WitnessService;
Parameters
client

Auths

Returns

WitnessService

Methods

add()
add(opts): WitnessEntry;

Adds a witness node. Idempotent — adding the same URL twice is a no-op.

Parameters
opts

AddWitnessOptions

Witness options.

Returns

WitnessEntry

The witness entry.

Throws

StorageError if the operation fails.

Example
const w = auths.witnesses.add({ url: 'http://witness.example.com:3333' })
console.log(w.url) // http://witness.example.com:3333
list()
list(): WitnessEntry[];

Lists all registered witnesses.

Returns

WitnessEntry[]

Array of witness entries.

Throws

StorageError if the operation fails.

remove()
remove(url): void;

Removes a witness by URL.

Parameters
url

string

URL of the witness to remove.

Returns

void

Throws

StorageError if the operation fails.

Interfaces

ActionEnvelope

A signed action envelope containing the payload and its signature.

Properties

envelopeJson
envelopeJson: string;

JSON-serialized envelope with action metadata.

signatureHex
signatureHex: string;

Hex-encoded signature over the envelope.

signerDid
signerDid: string;

DID of the signer.


AddOrgMemberOptions

Options for OrgService.addMember.

Properties

capabilities?
optional capabilities: string[];

Capabilities to grant the member.

memberDid
memberDid: string;

DID of the member to add.

memberPublicKeyHex?
optional memberPublicKeyHex: string;

Hex-encoded public key of the member (required for cross-repo adds).

note?
optional note: string;

Optional note for the membership record.

orgDid
orgDid: string;

DID of the organization.

passphrase?
optional passphrase: string;

Override the client's passphrase.

role
role: string;

Role to assign (e.g. 'admin', 'member').


AddWitnessOptions

Options for WitnessService.add.

Properties

label?
optional label: string;

Optional label for the witness.

url
url: string;

URL of the witness endpoint (e.g. 'http://witness.example.com:3333').


AgentIdentity

A standalone agent identity with its self-signed attestation.

Properties

attestation
attestation: string;

JSON-serialized self-signed attestation.

did
did: string;

The agent's KERI decentralized identifier.

keyAlias
keyAlias: string;

Keychain alias for the agent's signing key.

publicKey
publicKey: string;

Hex-encoded Ed25519 public key.


ArtifactResult

Result of signing an artifact.

Properties

attestationJson
attestationJson: string;

JSON-serialized attestation for the signed artifact.

digest
digest: string;

Content digest (hash) of the artifact.

fileSize
fileSize: number;

Size of the artifact in bytes.

rid
rid: string;

Unique resource identifier of the attestation.


AttestationInfo

An attestation record from the local registry.

Properties

capabilities
capabilities: string[];

List of capabilities granted (e.g. ['sign']).

createdAt
createdAt: string | null;

Creation timestamp (RFC 3339), or null.

delegatedBy
delegatedBy: string | null;

DID of the identity that delegated this attestation, or null.

deviceDid
deviceDid: string;

DID of the device this attestation applies to.

expiresAt
expiresAt: string | null;

Expiration timestamp (RFC 3339), or null if no expiry.

issuer
issuer: string;

DID of the issuer (identity that signed the attestation).

json
json: string;

Raw JSON-serialized attestation.

revokedAt
revokedAt: string | null;

Revocation timestamp (RFC 3339), or null if not revoked.

rid
rid: string;

Unique resource identifier of the attestation.

signerType
signerType: string | null;

Signer type: 'human', 'agent', or 'workload', or null.

subject
subject: string;

DID of the subject (device or agent being attested).


AuditCommit

Audit information for a single Git commit.

Properties

author_email
author_email: string;

Commit author email.

author_name
author_name: string;

Commit author name.

date
date: string;

Commit date (ISO 8601).

message
message: string;

Commit message (first line).

oid
oid: string;

Git object ID (SHA).

signature_type
signature_type: string | null;

Signature type ('auths', 'gpg', 'ssh'), or null if unsigned.

signer_did
signer_did: string | null;

DID of the signer, or null if not an Auths signature.

verified
verified: boolean | null;

Whether the signature verified successfully, or null if unsigned.


AuditComplianceOptions

Options for AuditService.isCompliant.

Properties

author?
optional author: string;

Only include commits by this author.

since?
optional since: string;

Only include commits after this date (ISO 8601).

targetRepoPath
targetRepoPath: string;

Path to the Git repository to audit.

until?
optional until: string;

Only include commits before this date (ISO 8601).


AuditReport

Full audit report for a Git repository's commit signatures.

Properties

commits
commits: AuditCommit[];

Individual commit audit entries.

summary
summary: AuditSummary;

Aggregate signature statistics.


AuditReportOptions

Options for AuditService.report.

Properties

author?
optional author: string;

Only include commits by this author.

limit?
optional limit: number;

Maximum number of commits to analyze.

since?
optional since: string;

Only include commits after this date (ISO 8601).

targetRepoPath
targetRepoPath: string;

Path to the Git repository to audit.

until?
optional until: string;

Only include commits before this date (ISO 8601).


AuditSummary

Aggregate statistics from an audit report.

Properties

auths_signed
auths_signed: number;

Number of Auths-signed commits.

gpg_signed
gpg_signed: number;

Number of GPG-signed commits.

signed_commits
signed_commits: number;

Number of signed commits (any method).

ssh_signed
ssh_signed: number;

Number of SSH-signed commits.

total_commits
total_commits: number;

Total number of commits analyzed.

unsigned_commits
unsigned_commits: number;

Number of unsigned commits.

verification_failed
verification_failed: number;

Number of signatures that failed verification.

verification_passed
verification_passed: number;

Number of signatures that passed verification.


A single link in a verified attestation chain.

Properties

error?
optional error: string | null;

Error message if this link failed, or null.

issuer
issuer: string;

DID of the issuer at this link.

subject
subject: string;

DID of the subject at this link.

valid
valid: boolean;

Whether this link verified successfully.


ClientConfig

Configuration for the Auths client.

Properties

passphrase?
optional passphrase: string;

Passphrase for key encryption. Can also be set via AUTHS_PASSPHRASE env var.

repoPath?
optional repoPath: string;

Path to the Auths Git registry. Defaults to '~/.auths'.


CommitSignResult

Result of signing a Git commit.

Properties

method
method: string;

Signing method identifier.

namespace
namespace: string;

Namespace for the signature (e.g. 'auths').

signaturePem
signaturePem: string;

PEM-encoded signature for the commit.


CompletePairingOptions

Options for PairingService.complete.

Properties

capabilities?
optional capabilities: string[];

Capabilities to grant the device.

deviceDid
deviceDid: string;

DID of the device to authorize.

devicePublicKeyHex
devicePublicKeyHex: string;

Hex-encoded Ed25519 public key of the device.

passphrase?
optional passphrase: string;

Override the client's passphrase.


CreateAgentOptions

Options for IdentityService.createAgent.

Properties

capabilities
capabilities: string[];

Capabilities to grant (e.g. ['sign']).

name
name: string;

Name for the agent identity.

passphrase?
optional passphrase: string;

Override the client's passphrase.


CreateIdentityOptions

Options for IdentityService.create.

Properties

label?
optional label: string;

Human-readable label. Defaults to 'main'.

passphrase?
optional passphrase: string;

Override the client's passphrase.

repoPath?
optional repoPath: string;

Override the client's repo path.


CreateOrgOptions

Options for OrgService.create.

Properties

label
label: string;

Human-readable label for the organization.

passphrase?
optional passphrase: string;

Override the client's passphrase.

repoPath?
optional repoPath: string;

Override the client's repo path.


CreatePairingSessionOptions

Options for PairingService.createSession.

Properties

bindAddress?
optional bindAddress: string;

Bind address for the pairing server (e.g. '127.0.0.1').

capabilities?
optional capabilities: string[];

Capabilities to offer the pairing device (e.g. ['sign:commit']).

enableMdns?
optional enableMdns: boolean;

Whether to enable mDNS discovery.

passphrase?
optional passphrase: string;

Override the client's passphrase.

timeoutSecs?
optional timeoutSecs: number;

Timeout in seconds for the session.


DelegateAgentOptions

Options for IdentityService.delegateAgent.

Properties

capabilities
capabilities: string[];

Capabilities to grant (e.g. ['sign']).

expiresInDays?
optional expiresInDays: number;

Optional expiration in days.

identityDid
identityDid: string;

DID of the parent identity that delegates authority.

name
name: string;

Name for the delegated agent.

passphrase?
optional passphrase: string;

Override the client's passphrase.


DelegatedAgent

An agent delegated under an existing identity.

Properties

attestation
attestation: string;

JSON-serialized delegation attestation signed by the parent identity.

did
did: string;

The delegated agent's DID (typically did:key:z...).

keyAlias
keyAlias: string;

Keychain alias for the agent's signing key.

publicKey
publicKey: string;

Hex-encoded Ed25519 public key.


Device

Result of linking a device to an identity.

Properties

attestationId
attestationId: string;

Unique identifier of the attestation granting device authorization.

did
did: string;

The device's DID (typically did:key:z...).


DeviceExtension

Result of extending a device's authorization period.

Properties

deviceDid
deviceDid: string;

The device's DID.

newExpiresAt
newExpiresAt: string;

New expiration timestamp (RFC 3339).

previousExpiresAt
previousExpiresAt: string | null;

Previous expiration timestamp, or null if there was none.


EvalContextOpts

Context for policy evaluation.

Properties

capabilities?
optional capabilities: string[];

Capabilities held by the subject.

chainDepth?
optional chainDepth: number;

Depth of the attestation chain.

delegatedBy?
optional delegatedBy: string;

DID of the delegating identity.

environment?
optional environment: string;

Deployment environment (e.g. 'production').

expiresAt?
optional expiresAt: string;

Expiration timestamp (RFC 3339).

issuer
issuer: string;

DID of the attestation issuer.

repo?
optional repo: string;

Repository scope (e.g. 'org/repo').

revoked?
optional revoked: boolean;

Whether the attestation has been revoked.

role?
optional role: string;

Role of the subject (e.g. 'admin', 'member').

signerType?
optional signerType: "human" | "agent" | "workload";

Signer type constraint.

subject
subject: string;

DID of the attestation subject.


ExtendDeviceOptions

Options for DeviceService.extend.

Properties

days?
optional days: number;

Number of days to extend by. Defaults to 90.

deviceDid
deviceDid: string;

DID of the device to extend.

identityDid
identityDid: string;

DID of the authorizing identity.

passphrase?
optional passphrase: string;

Override the client's passphrase.


GetPublicKeyOptions

Options for IdentityService.getPublicKey.

Properties

identityDid
identityDid: string;

DID of the identity whose public key to retrieve.

passphrase?
optional passphrase: string;

Override the client's passphrase.


Identity

A cryptographic identity anchored in a KERI key event log.

Properties

did
did: string;

The KERI decentralized identifier (e.g. did:keri:EBfd...).

keyAlias
keyAlias: string;

Keychain alias used to retrieve the signing key.

label
label: string;

Human-readable label for this identity.

publicKey
publicKey: string;

Hex-encoded Ed25519 public key.

repoPath
repoPath: string;

Path to the Git registry that stores this identity.


JoinPairingOptions

Options for PairingService.join.

Properties

deviceName?
optional deviceName: string;

Optional name for this device.

endpoint
endpoint: string;

HTTP endpoint of the pairing session.

passphrase?
optional passphrase: string;

Override the client's passphrase.

shortCode
shortCode: string;

Six-character short code from the pairing session.

token
token: string;

Authentication token for the session.


LinkDeviceOptions

Options for DeviceService.link.

Properties

capabilities?
optional capabilities: string[];

Capabilities to grant the device (e.g. ['sign']).

expiresInDays?
optional expiresInDays: number;

Optional expiration in days.

identityDid
identityDid: string;

DID of the identity to link the device under.

passphrase?
optional passphrase: string;

Override the client's passphrase.


ListOrgMembersOptions

Options for OrgService.listMembers.

Properties

includeRevoked?
optional includeRevoked: boolean;

Whether to include revoked members. Defaults to false.

orgDid
orgDid: string;

DID of the organization.


OrgMember

An organization member record.

Properties

attestationRid
attestationRid: string;

Resource identifier of the membership attestation.

capabilities
capabilities: string[];

Capabilities granted to this member.

expiresAt
expiresAt: string | null;

Expiration timestamp (RFC 3339), or null if no expiry.

issuerDid
issuerDid: string;

DID of the admin who added this member.

memberDid
memberDid: string;

DID of the member.

revoked
revoked: boolean;

Whether the membership has been revoked.

role
role: string;

Role within the organization (e.g. 'admin', 'member').


OrgResult

Result of creating an organization.

Properties

label
label: string;

Human-readable label.

orgDid
orgDid: string;

The organization's KERI DID.

orgPrefix
orgPrefix: string;

Internal prefix for the organization.

repoPath
repoPath: string;

Path to the registry storing the organization.


PairingResponse

Response received when a device connects to a pairing session.

Properties

deviceDid
deviceDid: string;

DID of the connecting device.

deviceName
deviceName: string | null;

Optional name of the device, or null.

devicePublicKeyHex
devicePublicKeyHex: string;

Hex-encoded Ed25519 public key of the device.


PairingResult

Result of completing a pairing and authorizing the device.

Properties

attestationRid
attestationRid: string;

Resource identifier of the authorization attestation.

deviceDid
deviceDid: string;

DID of the paired device.

deviceName
deviceName: string | null;

Optional name of the device, or null.


PairingSession

An active pairing session awaiting a device connection.

Properties

controllerDid
controllerDid: string;

DID of the controller identity running the session.

endpoint
endpoint: string;

HTTP endpoint the device connects to.

sessionId
sessionId: string;

Unique session identifier.

shortCode
shortCode: string;

Six-character code the device enters to pair.

token
token: string;

Authentication token for the session.


PinIdentityOptions

Options for TrustService.pin.

Properties

did
did: string;

DID of the identity to pin.

label?
optional label: string;

Optional label for the pinned identity.

trustLevel?
optional trustLevel: "tofu" | "manual" | "org_policy";

Trust level to assign. Defaults to 'tofu'.


PinnedIdentity

A pinned (trusted) identity in the local trust store.

Properties

did
did: string;

The pinned identity's DID.

firstSeen
firstSeen: string;

ISO 8601 timestamp when this identity was first seen.

kelSequence
kelSequence: number | null;

KERI event log sequence number at time of pinning, or null.

label
label: string | null;

Optional label for the pinned identity.

pinnedAt
pinnedAt: string;

ISO 8601 timestamp when this identity was pinned.

trustLevel
trustLevel: string;

Trust level: 'tofu', 'manual', or 'org_policy'.


PolicyDecision

Result of evaluating a policy against a context.

Properties

allowed
allowed: boolean;

Convenience: true when outcome === 'allow'.

denied
denied: boolean;

Convenience: true when outcome === 'deny'.

message
message: string;

Human-readable explanation of the decision.

outcome
outcome: string;

Raw outcome string ('allow' or 'deny').

reason
reason: string;

Machine-readable reason code.


RevokeDeviceOptions

Options for DeviceService.revoke.

Properties

deviceDid
deviceDid: string;

DID of the device to revoke.

identityDid
identityDid: string;

DID of the identity that authorized the device.

note?
optional note: string;

Optional revocation note.

passphrase?
optional passphrase: string;

Override the client's passphrase.


RevokeOrgMemberOptions

Options for OrgService.revokeMember.

Properties

memberDid
memberDid: string;

DID of the member to revoke.

memberPublicKeyHex?
optional memberPublicKeyHex: string;

Hex-encoded public key of the member.

note?
optional note: string;

Optional revocation note.

orgDid
orgDid: string;

DID of the organization.

passphrase?
optional passphrase: string;

Override the client's passphrase.


RotateKeysOptions

Options for IdentityService.rotate.

Properties

identityDid?
optional identityDid: string;

DID of the identity to rotate. Defaults to the primary identity.

passphrase?
optional passphrase: string;

Override the client's passphrase.


RotationResult

Result of a key rotation operation.

Properties

controllerDid
controllerDid: string;

The controller DID whose keys were rotated.

newKeyFingerprint
newKeyFingerprint: string;

Fingerprint of the new signing key.

previousKeyFingerprint
previousKeyFingerprint: string;

Fingerprint of the previous signing key.

sequence
sequence: number;

New KERI event sequence number after rotation.


SignActionAsAgentOptions

Options for SigningService.signActionAsAgent.

Properties

actionType
actionType: string;

Action type label (e.g. 'tool_call').

agentDid
agentDid: string;

DID of the agent identity.

keyAlias
keyAlias: string;

Keychain alias of the agent key.

passphrase?
optional passphrase: string;

Override the client's passphrase.

payloadJson
payloadJson: string;

JSON-serialized action payload.


SignActionAsIdentityOptions

Options for SigningService.signActionAsIdentity.

Properties

actionType
actionType: string;

Action type label (e.g. 'tool_call').

identityDid
identityDid: string;

DID of the identity to sign with.

passphrase?
optional passphrase: string;

Override the client's passphrase.

payloadJson
payloadJson: string;

JSON-serialized action payload.


SignArtifactBytesOptions

Options for ArtifactService.signBytes.

Properties

data
data: Buffer;

Raw bytes to sign.

expiresInDays?
optional expiresInDays: number;

Optional expiration in days.

identityDid
identityDid: string;

DID of the identity to sign with.

note?
optional note: string;

Optional note attached to the attestation.

passphrase?
optional passphrase: string;

Override the client's passphrase.


SignArtifactOptions

Options for ArtifactService.sign.

Properties

expiresInDays?
optional expiresInDays: number;

Optional expiration in days.

filePath
filePath: string;

Path to the file to sign.

identityDid
identityDid: string;

DID of the identity to sign with.

note?
optional note: string;

Optional note attached to the attestation.

passphrase?
optional passphrase: string;

Override the client's passphrase.


SignAsAgentOptions

Options for SigningService.signAsAgent.

Properties

keyAlias
keyAlias: string;

Keychain alias of the agent key.

message
message: Buffer;

The message bytes to sign.

passphrase?
optional passphrase: string;

Override the client's passphrase.


SignAsIdentityOptions

Options for SigningService.signAsIdentity.

Properties

identityDid
identityDid: string;

DID of the identity to sign with.

message
message: Buffer;

The message bytes to sign.

passphrase?
optional passphrase: string;

Override the client's passphrase.


SignCommitOptions

Options for CommitService.sign.

Properties

data
data: Buffer;

Raw commit data to sign.

identityDid
identityDid: string;

DID of the identity to sign with.

passphrase?
optional passphrase: string;

Override the client's passphrase.


SignResult

Result of a signing operation.

Properties

signature
signature: string;

Hex-encoded Ed25519 signature.

signerDid
signerDid: string;

DID of the signer.


VerificationReport

Full report from a chain verification.

Properties

chain
chain: ChainLink[];

Individual chain link results.

status
status: VerificationStatus;

Overall verification status.

warnings
warnings: string[];

Non-fatal warnings encountered during verification.


VerificationResult

Result of verifying a single attestation.

Properties

error?
optional error: string | null;

Error message if verification failed, or null.

errorCode?
optional errorCode: string | null;

Machine-readable error code, or null.

valid
valid: boolean;

Whether the attestation is valid.


VerificationStatus

Status summary of a chain verification.

Properties

at?
optional at: string | null;

Timestamp context for the status, or null.

optional missingLink: string | null;

DID of the missing link in the chain, or null.

required?
optional required: number | null;

Number of required witnesses, or null.

statusType
statusType: string;

Status type: 'Valid', 'Invalid', 'Expired', etc.

step?
optional step: number | null;

Chain step where verification failed, or null.

verified?
optional verified: number | null;

Number of verified witnesses, or null.


VerifyChainOptions

Options for Auths.verifyChain.

Properties

attestations
attestations: string[];

Array of JSON-serialized attestations (leaf to root).

requiredCapability?
optional requiredCapability: string;

Optional capability the leaf attestation must grant.

rootKey
rootKey: string;

Hex-encoded Ed25519 public key of the root identity.

witnesses?
optional witnesses: WitnessConfig;

Optional witness configuration for receipt-based verification.


VerifyOptions

Options for Auths.verify.

Properties

at?
optional at: string;

Optional RFC 3339 timestamp to verify at.

attestationJson
attestationJson: string;

JSON-serialized attestation to verify.

issuerKey
issuerKey: string;

Hex-encoded Ed25519 public key of the issuer.

requiredCapability?
optional requiredCapability: string;

Optional capability the attestation must grant.


WaitForPairingResponseOptions

Options for PairingService.waitForResponse.

Properties

timeoutSecs?
optional timeoutSecs: number;

Timeout in seconds to wait for a device.


WitnessConfig

Configuration for witness-backed chain verification.

Properties

keys
keys: WitnessKey[];

Witness public keys.

receipts
receipts: string[];

JSON-serialized witness receipts.

threshold
threshold: number;

Minimum number of witness receipts required.


WitnessEntry

A witness node entry in the local registry.

Properties

did
did: string | null;

DID of the witness, or null if not yet resolved.

label
label: string | null;

Optional label for the witness.

url
url: string;

URL of the witness endpoint.


WitnessKey

Public key of a witness node.

Properties

did
did: string;

DID of the witness.

publicKeyHex
publicKeyHex: string;

Hex-encoded Ed25519 public key of the witness.

Variables

version()

const version: () => string = native.version;

Returns

string

Functions

compilePolicy()

function compilePolicy(policyJson): string;

Compiles a raw policy JSON string for use with evaluatePolicy.

Parameters

policyJson

string

JSON string of the policy expression.

Returns

string

Compiled policy JSON.

Throws

AuthsError if the policy is invalid.


evaluatePolicy()

function evaluatePolicy(compiledPolicyJson, context): PolicyDecision;

Evaluates a compiled policy against an attestation context.

Parameters

compiledPolicyJson

string

Compiled policy from compilePolicy or PolicyBuilder.build.

context

EvalContextOpts

The evaluation context.

Returns

PolicyDecision

The policy decision with allowed/denied convenience booleans.

Throws

AuthsError if evaluation fails.

Example

import { compilePolicy, evaluatePolicy } from '@auths-dev/node'

const compiled = compilePolicy(policyJson)
const decision = evaluatePolicy(compiled, {
  issuer: 'did:keri:EOrg',
  subject: 'did:key:zDevice',
})

mapNativeError()

function mapNativeError(err, defaultCls?): AuthsError;

Maps a native napi-rs error into a typed AuthsError subclass.

Parses the [AUTHS_CODE] message format emitted by the Rust layer and instantiates the appropriate error class with a machine-readable code.

Parameters

err

unknown

The raw error from the native binding.

defaultCls?

(message, code) => AuthsError

Fallback error class when the code is unrecognized.

Returns

AuthsError

A typed AuthsError instance.


verifyAttestation()

function verifyAttestation(attestationJson, issuerPkHex): Promise<VerificationResult>;

Verifies a single attestation against an issuer's public key.

Parameters

attestationJson

string

JSON-serialized attestation.

issuerPkHex

string

Hex-encoded Ed25519 public key of the issuer.

Returns

Promise\<VerificationResult>

The verification result.

Throws

VerificationError if verification encounters an error.

Example

import { verifyAttestation } from '@auths-dev/node'

const result = await verifyAttestation(attestationJson, publicKeyHex)
console.log(result.valid) // true

verifyAttestationWithCapability()

function verifyAttestationWithCapability(
   attestationJson,
   issuerPkHex,
requiredCapability): Promise<VerificationResult>;

Verifies a single attestation with a required capability check.

Parameters

attestationJson

string

JSON-serialized attestation.

issuerPkHex

string

Hex-encoded Ed25519 public key of the issuer.

requiredCapability

string

Capability the attestation must grant.

Returns

Promise\<VerificationResult>

The verification result.

Throws

VerificationError if verification fails.


verifyAtTime()

function verifyAtTime(
   attestationJson,
   issuerPkHex,
atRfc3339): Promise<VerificationResult>;

Verifies a single attestation at a specific point in time.

Parameters

attestationJson

string

JSON-serialized attestation.

issuerPkHex

string

Hex-encoded Ed25519 public key of the issuer.

atRfc3339

string

RFC 3339 timestamp to verify at.

Returns

Promise\<VerificationResult>

The verification result.

Throws

VerificationError if verification fails.


verifyAtTimeWithCapability()

function verifyAtTimeWithCapability(
   attestationJson,
   issuerPkHex,
   atRfc3339,
requiredCapability): Promise<VerificationResult>;

Verifies an attestation at a specific time with a required capability.

Parameters

attestationJson

string

JSON-serialized attestation.

issuerPkHex

string

Hex-encoded Ed25519 public key of the issuer.

atRfc3339

string

RFC 3339 timestamp to verify at.

requiredCapability

string

Capability the attestation must grant.

Returns

Promise\<VerificationResult>

The verification result.

Throws

VerificationError if verification fails.


verifyChain()

function verifyChain(attestationsJson, rootPkHex): Promise<VerificationReport>;

Verifies an attestation chain from leaf to root.

Parameters

attestationsJson

string[]

Array of JSON-serialized attestations (leaf to root).

rootPkHex

string

Hex-encoded Ed25519 public key of the root identity.

Returns

Promise\<VerificationReport>

The verification report with chain link details.

Throws

VerificationError if verification encounters an error.

Example

import { verifyChain } from '@auths-dev/node'

const report = await verifyChain(attestationChain, rootPublicKeyHex)
console.log(report.status.statusType) // 'Valid'

verifyChainWithCapability()

function verifyChainWithCapability(
   attestationsJson,
   rootPkHex,
requiredCapability): Promise<VerificationReport>;

Verifies an attestation chain with a required capability at the leaf.

Parameters

attestationsJson

string[]

Array of JSON-serialized attestations (leaf to root).

rootPkHex

string

Hex-encoded Ed25519 public key of the root identity.

requiredCapability

string

Capability the leaf attestation must grant.

Returns

Promise\<VerificationReport>

The verification report.

Throws

VerificationError if verification fails.


verifyChainWithWitnesses()

function verifyChainWithWitnesses(
   attestationsJson,
   rootPkHex,
witnesses): Promise<VerificationReport>;

Verifies an attestation chain with witness receipt validation.

Parameters

attestationsJson

string[]

Array of JSON-serialized attestations (leaf to root).

rootPkHex

string

Hex-encoded Ed25519 public key of the root identity.

witnesses

WitnessConfig

Witness configuration with receipts, keys, and threshold.

Returns

Promise\<VerificationReport>

The verification report.

Throws

VerificationError if verification fails.

Example

import { verifyChainWithWitnesses } from '@auths-dev/node'

const report = await verifyChainWithWitnesses(chain, rootKey, {
  receipts: witnessReceipts,
  keys: [{ did: witnessDid, publicKeyHex: witnessKey }],
  threshold: 1,
})

verifyDeviceAuthorization()

function verifyDeviceAuthorization(
   identityDid,
   deviceDid,
   attestationsJson,
identityPkHex): Promise<VerificationReport>;

Verifies that a device is authorized by an identity through an attestation chain.

Parameters

identityDid

string

DID of the authorizing identity.

deviceDid

string

DID of the device to verify.

attestationsJson

string[]

Array of JSON-serialized attestations.

identityPkHex

string

Hex-encoded Ed25519 public key of the identity.

Returns

Promise\<VerificationReport>

The verification report.

Throws

VerificationError if verification fails.