zorin-authority-sdk-ts — API
AuthorizeInput
Section titled “AuthorizeInput”export type AuthorizeInput = { projectId: string; origin: string; challenge: string; action: string; resource: string; message?: string; ttlSeconds?: number;};AuthorityRequest
Section titled “AuthorityRequest”export type AuthorityRequest = { id: string; project_id: string; origin: string; challenge: string; action: string; resource: string; message: string; status: 'pending' | 'approved' | 'denied' | 'expired' | 'error'; error?: string; assertion?: string; created_at: string; expires_at: string;};OwnerProof
Section titled “OwnerProof”export type OwnerProof = { version: 'ZOWNER/1'; action: string; resource: string; host_fingerprint: string; phone_fingerprint: string; phone_public_key_der_hex: string; nonce: string; issued_unix: number; expires_unix: number; signature_der_hex: string;};AssertionPayload
Section titled “AssertionPayload”export type AssertionPayload = { v: 'ZAUTH/1'; iss: string; aud: string; origin: string; challenge: string; action: string; resource: string; iat: number; exp: number; jti: string; assurance: string; host_fp: string; phone_fp: string; owner_proof: OwnerProof;};VerifyExpected
Section titled “VerifyExpected”export type VerifyExpected = { aud: string; origin: string; challenge: string; action: string; resource: string; phonePublicKeyDERHex: string;};authorize
Section titled “authorize”export async function authorize(input: AuthorizeInput, opts: { baseUrl?: string; timeoutMs?: number;} = {}): Promise<AuthorityRequest>parseAssertion
Section titled “parseAssertion”export function parseAssertion(assertion: string): AssertionPayloadverifyAssertion
Section titled “verifyAssertion”export async function verifyAssertion(assertion: string, brokerPublicKeyPem: string, expected: VerifyExpected, now = Math.floor(Date.now() / 1000)): Promise<AssertionPayload>