From e05f00867dc6ac21dde445ecde3a343ee5dca3e1 Mon Sep 17 00:00:00 2001 From: Orie Steele Date: Thu, 3 Oct 2024 12:42:05 -0500 Subject: [PATCH] cleaning --- scripts/make-iana-assignments.ts | 2 +- src/cbor/pretty/prettyCoseKey.ts | 2 +- src/cbor/pretty/prettyProofs.ts | 4 ++-- src/iana/assignments/cose.ts | 40 ++++++++++++++++---------------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/make-iana-assignments.ts b/scripts/make-iana-assignments.ts index f4d5c4c..20d2969 100644 --- a/scripts/make-iana-assignments.ts +++ b/scripts/make-iana-assignments.ts @@ -17,7 +17,7 @@ const cddlToType = (cddl: string) => { return cddl .replace(/\//g, '|') .replace(/tstr/g, 'string') - .replace(/bstr/g, 'Buffer') + .replace(/bstr/g, 'ArrayBuffer') .replace(/uint/g, 'number') .replace(/int/g, 'number') .replace(/bool/g, 'boolean') diff --git a/src/cbor/pretty/prettyCoseKey.ts b/src/cbor/pretty/prettyCoseKey.ts index 2e86aa4..9c3de92 100644 --- a/src/cbor/pretty/prettyCoseKey.ts +++ b/src/cbor/pretty/prettyCoseKey.ts @@ -5,7 +5,7 @@ import { ellideBytes } from './ellideBytes' import { ec2_key, cose_key, cose_key_type, ec2, any_cose_key } from '../../iana/assignments/cose' -export const prettyCoseKey = (data: Buffer) => { +export const prettyCoseKey = (data: ArrayBuffer) => { const decoded = cbor.decode(data) as any_cose_key const kty = decoded.get(cose_key.kty as any) as any if (kty === cose_key_type.ec2) { diff --git a/src/cbor/pretty/prettyProofs.ts b/src/cbor/pretty/prettyProofs.ts index 406d3fb..ea3dbc8 100644 --- a/src/cbor/pretty/prettyProofs.ts +++ b/src/cbor/pretty/prettyProofs.ts @@ -7,7 +7,7 @@ import { ellideBytes } from './ellideBytes' import { rfc9162_sha256_proof_types, transparency } from '../../drafts/draft-ietf-cose-merkle-tree-proofs' import { indentBlock } from './indentBlock' -export const prettyInclusionProof = (proof: ArrayBuffer | [number, number, Buffer[]]) => { +export const prettyInclusionProof = (proof: ArrayBuffer | [number, number, ArrayBuffer[]]) => { const [size, index, path] = Array.isArray(proof) ? proof : cbor.decode(proof) return indentBlock(`<<[ / size / ${size}, / leaf / ${index}, @@ -18,7 +18,7 @@ ${path.length === 0 ? ' []' : path.map((p: ArrayBuffer) => { ]>>`, ' ') } -export const prettyConsistencyProof = (proof: ArrayBuffer | [number, number, Buffer[]]) => { +export const prettyConsistencyProof = (proof: ArrayBuffer | [number, number, ArrayBuffer[]]) => { const [size1, size2, path] = Array.isArray(proof) ? proof : cbor.decode(proof) return indentBlock(`<<[ diff --git a/src/iana/assignments/cose.ts b/src/iana/assignments/cose.ts index b1b951d..ad273bc 100644 --- a/src/iana/assignments/cose.ts +++ b/src/iana/assignments/cose.ts @@ -1499,51 +1499,51 @@ export enum walnutdsa { export type any_cose_key = Map & { - get(k: cose_key.kid): Buffer + get(k: cose_key.kid): ArrayBuffer get(k: cose_key.alg): string | number get(k: cose_key.key_ops): [ (string|number)] - get(k: cose_key.base_iv): Buffer + get(k: cose_key.base_iv): ArrayBuffer } export type okp_key = any_cose_key & { get(k: okp.kty): cose_key_type.okp get(k: okp.crv): okp_curves - get(k: okp.x): Buffer - get(k: okp.d): Buffer + get(k: okp.x): ArrayBuffer + get(k: okp.d): ArrayBuffer } export type ec2_key = any_cose_key & { get(k: ec2.kty): cose_key_type.ec2 get(k: ec2.crv): ec2_curves - get(k: ec2.x): Buffer - get(k: ec2.y): Buffer | boolean - get(k: ec2.d): Buffer + get(k: ec2.x): ArrayBuffer + get(k: ec2.y): ArrayBuffer | boolean + get(k: ec2.d): ArrayBuffer } export type rsa_key = any_cose_key & { get(k: rsa.kty): cose_key_type.rsa - get(k: rsa.n): Buffer - get(k: rsa.e): Buffer - get(k: rsa.d): Buffer - get(k: rsa.p): Buffer - get(k: rsa.q): Buffer - get(k: rsa.dp): Buffer - get(k: rsa.dq): Buffer - get(k: rsa.qinv): Buffer + get(k: rsa.n): ArrayBuffer + get(k: rsa.e): ArrayBuffer + get(k: rsa.d): ArrayBuffer + get(k: rsa.p): ArrayBuffer + get(k: rsa.q): ArrayBuffer + get(k: rsa.dp): ArrayBuffer + get(k: rsa.dq): ArrayBuffer + get(k: rsa.qinv): ArrayBuffer get(k: rsa.other): Array - get(k: rsa.r_i): Buffer - get(k: rsa.d_i): Buffer - get(k: rsa.t_i): Buffer + get(k: rsa.r_i): ArrayBuffer + get(k: rsa.d_i): ArrayBuffer + get(k: rsa.t_i): ArrayBuffer } export type symmetric_key = any_cose_key & { get(k: symmetric.kty): cose_key_type.symmetric - get(k: symmetric.k): Buffer + get(k: symmetric.k): ArrayBuffer } export type hss_lms_key = any_cose_key & { get(k: hss_lms.kty): cose_key_type.hss_lms - get(k: hss_lms.pub): Buffer + get(k: hss_lms.pub): ArrayBuffer } export type walnutdsa_key = any_cose_key & {