OpenAgentIDDocumentation
API referencenpm packages@openagentid/oas-attestation
OpenAgentIDAPI reference

@openagentid/oas-attestation

API contract shipped by @openagentid/oas-attestation 1.0.2. Exact exports, signatures, dependencies and availability.

All packages · Runnable examples · Start an agent

ContractValue
Package@openagentid/oas-attestation@1.0.2
Entry point@openagentid/oas-attestation
AvailabilityPublished package
Reference sourcePublished TypeScript declarations
Package enginesnode >=20

This reference is generated from the integrity-verified npm archive for this exact version. Signatures describe the public contract; they are not standalone programs. Complete examples are checked separately.

Import conditions

Use the public entry point above. The package resolves it to these shipped files; do not import its internal files directly.

ConditionPublished file
types./dist/index.d.ts
import./dist/index.js

Exports

AttestationError

Structured error for attestation operations.

Signature
export declare class AttestationError extends Error {
    readonly code: AttestationErrorCode;
    readonly details: Readonly<Record<string, unknown>>;
    constructor(code: AttestationErrorCode, message: string, details?: Record<string, unknown>);
}

Source: @openagentid/oas-attestation@1.0.2, dist/error.d.ts:32.

AttestationErrorCode

Error codes for attestation operations.

Signature
declare const AttestationErrorCode: {
    readonly InvalidIssuer: "INVALID_ISSUER";
    readonly InvalidSubject: "INVALID_SUBJECT";
    readonly UnknownAttestationType: "UNKNOWN_ATTESTATION_TYPE";
    readonly MissingProof: "MISSING_PROOF";
    readonly InvalidProofSignature: "INVALID_PROOF_SIGNATURE";
    readonly ProofGenerationFailed: "PROOF_GENERATION_FAILED";
    readonly Expired: "EXPIRED";
    readonly NotYetValid: "NOT_YET_VALID";
    readonly MissingField: "MISSING_FIELD";
    readonly Json: "JSON_ERROR";
    readonly Crypto: "CRYPTO_ERROR";
};

Source: @openagentid/oas-attestation@1.0.2, dist/error.d.ts:4.

Signature
export type AttestationErrorCode = (typeof AttestationErrorCode)[keyof typeof AttestationErrorCode];

Source: @openagentid/oas-attestation@1.0.2, dist/error.d.ts:28.

AttestationType

Standard OAS attestation types.

These represent the categories of verifiable claims that can be made about OAS entities.

Signature
declare const AttestationType: {
    readonly SecurityAudit: "SecurityAudit";
    readonly BehaviorAttestation: "BehaviorAttestation";
    readonly CapabilityVerification: "CapabilityVerification";
    readonly ComplianceAttestation: "ComplianceAttestation";
    readonly ExpertEndorsement: "ExpertEndorsement";
    readonly CommunityReview: "CommunityReview";
};

Source: @openagentid/oas-attestation@1.0.2, dist/types.d.ts:7.

AttestationTypeValue

Union of standard attestation types and custom strings.

Type-only declaration; it is not a runtime value.

Signature
export type AttestationTypeValue = StandardAttestationType | `Custom:${string}`;

Source: @openagentid/oas-attestation@1.0.2, dist/types.d.ts:25.

CredentialBuilder

Fluent builder for constructing OAS Verifiable Credentials.

Signature
export declare class CredentialBuilder {
    issuer(did: string): this;
    issuanceDate(date: string): this;
    expirationDate(date: string): this;
    subject(claims: Record<string, unknown>): this;
    attestationType(type: AttestationTypeValue): this;
    build(): OasCredential;
}

Source: @openagentid/oas-attestation@1.0.2, dist/credential.d.ts:69.

CredentialProof

A proof attached to an OAS credential.

Type-only declaration; it is not a runtime value.

Signature
export interface CredentialProof {
    readonly type: 'Ed25519Signature2020';
    readonly created: string;
    readonly verificationMethod: string;
    readonly proofPurpose: 'assertionMethod';
    readonly proofValue: string;
}

Source: @openagentid/oas-attestation@1.0.2, dist/credential.d.ts:13.

OAS_ATTESTATION_CONTEXT

OAS Attestation context.

Signature
declare const OAS_ATTESTATION_CONTEXT: "https://openagent.id/ns/attestation/v1";

Source: @openagentid/oas-attestation@1.0.2, dist/credential.d.ts:9.

OasCredential

An OAS Verifiable Credential.

Extends the W3C Verifiable Credentials model with OAS-specific attestation types. Credentials are immutable once signed.

Type-only declaration; it is not a runtime value.

Signature
export interface OasCredential {
    readonly '@context': ReadonlyArray<string>;
    readonly type: ReadonlyArray<string>;
    readonly issuer: string;
    readonly issuanceDate: string;
    readonly expirationDate?: string | undefined;
    readonly credentialSubject: Readonly<Record<string, unknown>>;
    readonly oasAttestationType?: AttestationTypeValue | undefined;
    readonly proof?: CredentialProof | undefined;
}

Source: @openagentid/oas-attestation@1.0.2, dist/credential.d.ts:31.

requiredFields

Returns the required fields for a given attestation type.

Signature
export declare function requiredFields(type: AttestationTypeValue): ReadonlyArray<string>;

Source: @openagentid/oas-attestation@1.0.2, dist/types.d.ts:32.

signCredential

Signs an OAS Verifiable Credential with an Ed25519 keypair.

The credential is JCS-canonicalized (without the proof field), signed, and a proof is attached. The attestation type's required fields are validated before signing.

Signature
export declare function signCredential(credential: OasCredential, keypair: OasKeyPair, verificationMethodId: string, created: string): Promise<OasCredential>;

Source: @openagentid/oas-attestation@1.0.2, dist/sign.d.ts:44.

throws: {

link: AttestationError} on validation or signing failure.

StandardAttestationType

Type-only declaration; it is not a runtime value.

Signature
export type StandardAttestationType = (typeof AttestationType)[keyof typeof AttestationType];

Source: @openagentid/oas-attestation@1.0.2, dist/types.d.ts:21.

validateSubject

Validates that a credential subject contains all required fields for its type.

Signature
export declare function validateSubject(type: AttestationTypeValue, subject: Record<string, unknown>): void;

Source: @openagentid/oas-attestation@1.0.2, dist/types.d.ts:40.

throws: {

link: AttestationError} if required fields are missing.

VC_CONTEXT

W3C Verifiable Credential context.

Signature
declare const VC_CONTEXT: "https://www.w3.org/2018/credentials/v1";

Source: @openagentid/oas-attestation@1.0.2, dist/credential.d.ts:5.

verifyCredential

Verifies an OAS Verifiable Credential's proof signature.

Signature
export declare function verifyCredential(credential: OasCredential, issuerPublicKeyBytes: Uint8Array): Promise<boolean>;

Source: @openagentid/oas-attestation@1.0.2, dist/verify.d.ts:18.

throws: {

link: AttestationError} if the credential is missing a proof.

verifyCredentialWithTime

Verifies a credential with temporal validation.

In addition to signature verification, checks:

  • The credential is not expired (if expirationDate is set)
  • The credential issuance date is not in the future
Signature
export declare function verifyCredentialWithTime(credential: OasCredential, issuerPublicKeyBytes: Uint8Array, now: string): Promise<boolean>;

Source: @openagentid/oas-attestation@1.0.2, dist/verify.d.ts:32.

throws: {

link: AttestationError} if temporal checks fail.

Supporting declarations

These package-owned declarations are referenced by the exports above. Their presence here does not make them importable from this entry point. Import only the names in Exports.

OasKeyPair

An Ed25519 keypair for an OAS entity.

Holds both the signing (private) and verifying (public) keys. The signing key is stored as a Uint8Array and should be zeroed when no longer needed.

Security

  • Private key bytes are never exposed via toString() or toJSON()
  • All signature operations use constant-time comparison internally via @noble/ed25519
  • Callers should zero the signing key bytes when the keypair is no longer needed: keypair.signingKeyBytes.fill(0)
Signature
export declare class OasKeyPair {
    static generate(): Promise<OasKeyPair>;
    static fromSigningKeyBytes(bytes: Uint8Array): Promise<OasKeyPair>;
    static verifyingKeyFromBytes(bytes: Uint8Array): Uint8Array;
    sign(message: Uint8Array): Promise<Uint8Array>;
    static verifyWithKey(publicKeyBytes: Uint8Array, message: Uint8Array, signatureBytes: Uint8Array): Promise<boolean>;
    get signingKeyBytes(): Uint8Array;
    get verifyingKeyBytes(): Uint8Array;
    publicKeyMultibase(): string;
    toString(): string;
    toJSON(): {
        verifyingKey: string;
    };
}

Source: @openagentid/oas-crypto@1.0.2, dist/keypair.d.ts:25.

Package requirements

Dependencies

PackagePublished range
@openagentid/oas-did1.0.2
@openagentid/oas-crypto1.0.2

Archive verification

Pinned integrity:

SHA-512 integrity
sha512-hJnGTwMMCqdO0vN1CIuD/SX1vaTfqMC8DnY/0w9gQ139jirIFw/rkbQQCzzBNUn6RYfqs94egefZwefUbuSdjQ==

Machine-readable API manifest · Coverage

On this page