@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
| Contract | Value |
|---|---|
| Package | @openagentid/oas-attestation@1.0.2 |
| Entry point | @openagentid/oas-attestation |
| Availability | Published package |
| Reference source | Published TypeScript declarations |
| Package engines | node >=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.
| Condition | Published file |
|---|---|
| types | ./dist/index.d.ts |
| import | ./dist/index.js |
Exports
AttestationErrorAttestationErrorCodeAttestationTypeAttestationTypeValue— typeCredentialBuilderCredentialProof— typeOAS_ATTESTATION_CONTEXTOasCredential— typerequiredFieldssignCredentialStandardAttestationType— typevalidateSubjectVC_CONTEXTverifyCredentialverifyCredentialWithTime
AttestationError
Structured error for attestation operations.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
expirationDateis set) - The credential issuance date is not in the future
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()ortoJSON() - 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)
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
| Package | Published range |
|---|---|
| @openagentid/oas-did | 1.0.2 |
| @openagentid/oas-crypto | 1.0.2 |
Archive verification
Pinned integrity:
sha512-hJnGTwMMCqdO0vN1CIuD/SX1vaTfqMC8DnY/0w9gQ139jirIFw/rkbQQCzzBNUn6RYfqs94egefZwefUbuSdjQ==