Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Oct 3, 2024
1 parent 0bdf3ec commit e05f008
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion scripts/make-iana-assignments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/cbor/pretty/prettyCoseKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/cbor/pretty/prettyProofs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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(`<<[
Expand Down
40 changes: 20 additions & 20 deletions src/iana/assignments/cose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1499,51 +1499,51 @@ export enum walnutdsa {


export type any_cose_key = Map<any, any> & {
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<any>
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 & {
Expand Down

0 comments on commit e05f008

Please sign in to comment.