Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transmute/cose

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transmute/cose - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

18

dist/cose/Params.d.ts

@@ -18,3 +18,2 @@ export type HeaderMapEntry = [number, any];

export declare const ContentType = 3;
export declare const ProofType = 395;
export declare const PayloadLocation = -6801;

@@ -25,2 +24,8 @@ export declare const PayloadPreImageContentType = -6802;

export declare const Type = 16;
export declare const Receipts = 394;
export declare const VerifiableDataStructure = 395;
export declare const VerifiableDataProofs = 396;
export declare const VerifiableDataStructures: {
'RFC9162-Binary-Merkle-Tree': number;
};
export declare const Protected: {

@@ -34,8 +39,8 @@ PartyUIdentity: number;

ContentType: number;
ProofType: number;
Type: number;
CWTClaims: number;
PayloadHashAlgorithm: number;
PayloadPreImageContentType: number;
PayloadLocation: number;
Type: number;
CWTClaims: number;
VerifiableDataStructure: number;
Alg: number;

@@ -49,2 +54,4 @@ Epk: number;

Ek: number;
Receipts: number;
VerifiableDataProofs: number;
Alg: number;

@@ -65,5 +72,2 @@ Epk: number;

};
export declare const Receipt: {
Inclusion: number;
};
export declare const KeyAgreement: {

@@ -70,0 +74,0 @@ 'ECDH-ES+HKDF-256': number;

@@ -5,3 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.COSE_Encrypt = exports.COSE_Sign1 = exports.COSE_Encrypt0 = exports.Curve = exports.Epk = exports.KeyType = exports.EC2 = exports.Direct = exports.KeyWrap = exports.KeyAgreementWithKeyWrap = exports.KeyAgreement = exports.Receipt = exports.Signature = exports.Hash = exports.Aead = exports.A128GCM = exports.Unprotected = exports.Protected = exports.Type = exports.CWTClaims = exports.PayloadHashAlgorithm = exports.PayloadPreImageContentType = exports.PayloadLocation = exports.ProofType = exports.ContentType = exports.PartyVOther = exports.PartyVNonce = exports.PartyVIdentity = exports.PartyUOther = exports.PartyUNonce = exports.PartyUIdentity = exports.HeaderParameters = exports.UnprotectedHeader = exports.ProtectedHeader = void 0;
exports.COSE_Encrypt = exports.COSE_Sign1 = exports.COSE_Encrypt0 = exports.Curve = exports.Epk = exports.KeyType = exports.EC2 = exports.Direct = exports.KeyWrap = exports.KeyAgreementWithKeyWrap = exports.KeyAgreement = exports.Signature = exports.Hash = exports.Aead = exports.A128GCM = exports.Unprotected = exports.Protected = exports.VerifiableDataStructures = exports.VerifiableDataProofs = exports.VerifiableDataStructure = exports.Receipts = exports.Type = exports.CWTClaims = exports.PayloadHashAlgorithm = exports.PayloadPreImageContentType = exports.PayloadLocation = exports.ContentType = exports.PartyVOther = exports.PartyVNonce = exports.PartyVIdentity = exports.PartyUOther = exports.PartyUNonce = exports.PartyUIdentity = exports.HeaderParameters = exports.UnprotectedHeader = exports.ProtectedHeader = void 0;
const ProtectedHeader = (entries) => {

@@ -28,3 +28,2 @@ return new Map(entries);

exports.ContentType = 3;
exports.ProofType = 395;
exports.PayloadLocation = -6801;

@@ -35,2 +34,9 @@ exports.PayloadPreImageContentType = -6802;

exports.Type = 16;
// https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs/
exports.Receipts = 394;
exports.VerifiableDataStructure = 395;
exports.VerifiableDataProofs = 396;
exports.VerifiableDataStructures = {
'RFC9162-Binary-Merkle-Tree': 1
};
exports.Protected = Object.assign(Object.assign({}, exports.HeaderParameters), { PartyUIdentity: exports.PartyUIdentity,

@@ -43,4 +49,6 @@ PartyUNonce: exports.PartyUNonce,

ContentType: exports.ContentType,
ProofType: exports.ProofType,
PayloadHashAlgorithm: // new from COSE Merkle Tree Proofs
Type: exports.Type,
CWTClaims: // https://datatracker.ietf.org/doc/html/rfc9596
exports.CWTClaims,
PayloadHashAlgorithm: // https://datatracker.ietf.org/doc/html/rfc9597
exports.PayloadHashAlgorithm,

@@ -50,8 +58,7 @@ PayloadPreImageContentType: // new COSE Hash Envelop

PayloadLocation: exports.PayloadLocation,
Type: exports.Type,
CWTClaims: // https://datatracker.ietf.org/doc/html/rfc9596
exports.CWTClaims // https://datatracker.ietf.org/doc/html/rfc9597
});
exports.Unprotected = Object.assign(Object.assign({}, exports.HeaderParameters), { Iv: 5, Ek: -4 // new from COSE HPKE
});
VerifiableDataStructure: exports.VerifiableDataStructure });
exports.Unprotected = Object.assign(Object.assign({}, exports.HeaderParameters), { Iv: 5, Ek: -4, // new from COSE HPKE
Receipts: // new from COSE HPKE
exports.Receipts,
VerifiableDataProofs: exports.VerifiableDataProofs });
exports.A128GCM = 1;

@@ -67,5 +74,2 @@ exports.Aead = {

};
exports.Receipt = {
Inclusion: 1
};
exports.KeyAgreement = {

@@ -72,0 +76,0 @@ 'ECDH-ES+HKDF-256': -25

@@ -18,3 +18,3 @@ "use strict";

const { protectedHeader, receipt, entries, signer } = req;
const consistencyVds = protectedHeader.get(395);
const consistencyVds = protectedHeader.get(__1.Protected.VerifiableDataStructure);
if (consistencyVds !== 1) {

@@ -29,7 +29,7 @@ throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs');

const receiptProtectedHeader = __1.cbor.decode(protectedHeaderBytes);
const inclusionVds = receiptProtectedHeader.get(395);
const inclusionVds = receiptProtectedHeader.get(__1.Protected.VerifiableDataStructure);
if (inclusionVds !== 1) {
throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs');
}
const [inclusion] = unprotectedHeaderMap.get(396).get(-1); // get first inclusion proof
const [inclusion] = unprotectedHeaderMap.get(__1.Unprotected.VerifiableDataProofs).get(-1); // get first inclusion proof
if (payload !== null) {

@@ -55,3 +55,3 @@ throw new Error('payload must be null for this type of proof');

const unprotectedHeader = new Map();
unprotectedHeader.set(396, proofs);
unprotectedHeader.set(__1.Unprotected.VerifiableDataProofs, proofs);
const consistency = yield signer.sign({

@@ -58,0 +58,0 @@ protectedHeader,

@@ -23,7 +23,7 @@ "use strict";

const protectedHeader = __1.cbor.decode(protectedHeaderBytes);
const vds = protectedHeader.get(395);
const vds = protectedHeader.get(__1.Protected.VerifiableDataStructure);
if (vds !== 1) {
throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs');
}
const proofs = unprotectedHeaderMap.get(396);
const proofs = unprotectedHeaderMap.get(__1.Unprotected.VerifiableDataProofs);
const [consistency] = proofs.get(-2); // get first consistency proof

@@ -30,0 +30,0 @@ if (payload !== null) {

@@ -17,3 +17,3 @@ "use strict";

const { protectedHeader, entry, entries, signer } = req;
const vds = protectedHeader.get(395);
const vds = protectedHeader.get(__1.Protected.VerifiableDataStructure);
if (vds !== 1) {

@@ -33,3 +33,3 @@ throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs');

const unprotectedHeader = new Map();
unprotectedHeader.set(396, proofs);
unprotectedHeader.set(__1.Unprotected.VerifiableDataProofs, proofs);
return signer.sign({

@@ -36,0 +36,0 @@ protectedHeader,

@@ -23,7 +23,7 @@ "use strict";

const protectedHeader = __1.cbor.decode(protectedHeaderBytes);
const vds = protectedHeader.get(395);
const vds = protectedHeader.get(__1.Protected.VerifiableDataStructure);
if (vds !== 1) {
throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs');
}
const proofs = unprotectedHeaderMap.get(396);
const proofs = unprotectedHeaderMap.get(__1.Unprotected.VerifiableDataProofs);
const [inclusion] = proofs.get(-1); // get first inclusion proof

@@ -30,0 +30,0 @@ if (payload !== null) {

{
"name": "@transmute/cose",
"version": "0.2.9",
"version": "0.2.10",
"description": "COSE and related work.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -76,3 +76,6 @@ # cose

[cose.Protected.Alg, cose.Signature.ES256],
[cose.Protected.ProofType, cose.Receipt.Inclusion],
[
cose.Protected.VerifiableDataStructure,
cose.VerifiableDataStructures["RFC9162-Binary-Merkle-Tree"],
],
[cose.Protected.Kid, notaryPublicKeyJwk.kid],

@@ -79,0 +82,0 @@ ]),

@@ -33,4 +33,2 @@ // This module is just just a limited set of the IANA registries,

export const ProofType = 395
export const PayloadLocation = -6801;

@@ -44,2 +42,11 @@ export const PayloadPreImageContentType = -6802;

// https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs/
export const Receipts = 394
export const VerifiableDataStructure = 395
export const VerifiableDataProofs = 396
export const VerifiableDataStructures = {
'RFC9162-Binary-Merkle-Tree': 1
}
export const Protected = {

@@ -54,4 +61,6 @@ ...HeaderParameters,

ContentType,
ProofType, // new from COSE Merkle Tree Proofs
Type, // https://datatracker.ietf.org/doc/html/rfc9596
CWTClaims, // https://datatracker.ietf.org/doc/html/rfc9597
PayloadHashAlgorithm, // new COSE Hash Envelop

@@ -61,10 +70,14 @@ PayloadPreImageContentType,

Type, // https://datatracker.ietf.org/doc/html/rfc9596
CWTClaims // https://datatracker.ietf.org/doc/html/rfc9597
VerifiableDataStructure,
}
export const Unprotected = {
...HeaderParameters,
Iv: 5,
Ek: -4 // new from COSE HPKE
Ek: -4, // new from COSE HPKE
Receipts,
VerifiableDataProofs
}

@@ -87,7 +100,3 @@

export const Receipt = {
Inclusion: 1
}
export const KeyAgreement = {

@@ -94,0 +103,0 @@ 'ECDH-ES+HKDF-256': -25

import { CoMETRE } from '@transmute/rfc9162'
import { cbor } from '../../..'
import { cbor, Protected, Unprotected } from '../../..'

@@ -18,3 +18,3 @@ import { CoseSign1Bytes, CoseSign1Signer, ProtectedHeaderMap } from "../../sign1"

const { protectedHeader, receipt, entries, signer } = req;
const consistencyVds = protectedHeader.get(395)
const consistencyVds = protectedHeader.get(Protected.VerifiableDataStructure)
if (consistencyVds !== 1) {

@@ -31,3 +31,3 @@ throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs')

const receiptProtectedHeader = cbor.decode(protectedHeaderBytes)
const inclusionVds = receiptProtectedHeader.get(395);
const inclusionVds = receiptProtectedHeader.get(Protected.VerifiableDataStructure);
if (inclusionVds !== 1) {

@@ -37,3 +37,3 @@ throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs')

const [inclusion] = unprotectedHeaderMap.get(396).get(-1) // get first inclusion proof
const [inclusion] = unprotectedHeaderMap.get(Unprotected.VerifiableDataProofs).get(-1) // get first inclusion proof
if (payload !== null) {

@@ -66,3 +66,3 @@ throw new Error('payload must be null for this type of proof')

const unprotectedHeader = new Map();
unprotectedHeader.set(396, proofs)
unprotectedHeader.set(Unprotected.VerifiableDataProofs, proofs)

@@ -69,0 +69,0 @@ const consistency = await signer.sign({

import { CoMETRE } from '@transmute/rfc9162'
import { cbor } from '../../..'
import { cbor, Protected, Unprotected } from '../../..'

@@ -23,7 +23,7 @@ import { CoseSign1Bytes, CoseSign1DetachedVerifier } from "../../sign1"

const protectedHeader = cbor.decode(protectedHeaderBytes)
const vds = protectedHeader.get(395);
const vds = protectedHeader.get(Protected.VerifiableDataStructure);
if (vds !== 1) {
throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs')
}
const proofs = unprotectedHeaderMap.get(396)
const proofs = unprotectedHeaderMap.get(Unprotected.VerifiableDataProofs)
const [consistency] = proofs.get(-2) // get first consistency proof

@@ -30,0 +30,0 @@ if (payload !== null) {

import { CoMETRE } from '@transmute/rfc9162'
import { cbor } from '../../..'
import { cbor, Protected, Unprotected } from '../../..'

@@ -17,3 +17,3 @@ import { CoseSign1Signer, ProtectedHeaderMap } from "../../sign1"

const { protectedHeader, entry, entries, signer } = req;
const vds = protectedHeader.get(395)
const vds = protectedHeader.get(Protected.VerifiableDataStructure)
if (vds !== 1) {

@@ -36,3 +36,3 @@ throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs')

const unprotectedHeader = new Map();
unprotectedHeader.set(396, proofs)
unprotectedHeader.set(Unprotected.VerifiableDataProofs, proofs)
return signer.sign({

@@ -39,0 +39,0 @@ protectedHeader,

import { CoMETRE } from '@transmute/rfc9162'
import { cbor } from '../../..'
import { cbor, Protected, Unprotected } from '../../..'

@@ -22,7 +22,7 @@ import { CoseSign1Bytes, CoseSign1DetachedVerifier } from "../../sign1"

const protectedHeader = cbor.decode(protectedHeaderBytes)
const vds = protectedHeader.get(395);
const vds = protectedHeader.get(Protected.VerifiableDataStructure);
if (vds !== 1) {
throw new Error('Unsupported verifiable data structure. See https://datatracker.ietf.org/doc/draft-ietf-cose-merkle-tree-proofs')
}
const proofs = unprotectedHeaderMap.get(396)
const proofs = unprotectedHeaderMap.get(Unprotected.VerifiableDataProofs)
const [inclusion] = proofs.get(-1) // get first inclusion proof

@@ -29,0 +29,0 @@ if (payload !== null) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc