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

@transmute/cose

Package Overview
Dependencies
Maintainers
3
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.0.11 to 0.0.12

7

dist/index.d.ts

@@ -1,2 +0,1 @@

/// <reference types="node" />
declare const cose: {

@@ -38,3 +37,3 @@ detached: {

verify_inclusion_proof: ({ leaf, signed_inclusion_proof, verifier, }: import("./types").RequestInclusionProofVerification) => Promise<Uint8Array>;
consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: import("./types").RequestConsistencyProof) => Promise<Buffer>;
consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: import("./types").RequestConsistencyProof) => Promise<Uint8Array>;
verify_consistency_proof: ({ old_root, signed_consistency_proof, verifier, }: import("./types").RequestConsistencyProofVerification) => Promise<boolean>;

@@ -49,3 +48,4 @@ };

unprotectedHeader: {
set: (message: Uint8Array, updated: import("./types").UnprotectedHeader) => Buffer;
get: (message: Uint8Array) => import("./types").UnprotectedHeader;
set: (message: Uint8Array, unprotectedMap: import("./types").UnprotectedHeader) => Uint8Array;
kid: number;

@@ -56,2 +56,3 @@ content_type: number;

consistency_proof: number;
receipt: number;
};

@@ -58,0 +59,0 @@ signer: ({ privateKeyJwk }: {

@@ -1,2 +0,1 @@

/// <reference types="node" />
declare const merkle: {

@@ -8,5 +7,5 @@ tree_alg: string;

verify_inclusion_proof: ({ leaf, signed_inclusion_proof, verifier, }: import("..").RequestInclusionProofVerification) => Promise<Uint8Array>;
consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: import("..").RequestConsistencyProof) => Promise<Buffer>;
consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: import("..").RequestConsistencyProof) => Promise<Uint8Array>;
verify_consistency_proof: ({ old_root, signed_consistency_proof, verifier, }: import("..").RequestConsistencyProofVerification) => Promise<boolean>;
};
export default merkle;

@@ -1,3 +0,2 @@

/// <reference types="node" />
import { RequestConsistencyProof } from '../types';
export declare const sign_consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: RequestConsistencyProof) => Promise<Buffer>;
export declare const sign_consistency_proof: ({ kid, alg, leaves, signed_inclusion_proof, signer, }: RequestConsistencyProof) => Promise<Uint8Array>;

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

const new_root = rfc9162_1.CoMETRE.RFC9162_SHA256.root(leaves);
const signed_root = yield signer.sign({
const signedMerkleRoot = yield signer.sign({
protectedHeader: {

@@ -37,4 +37,4 @@ alg,

});
const u = new Map();
u.set(unprotectedHeader_1.default.consistency_proof, cbor_1.default.encode([
const signedConsistencyProofUnprotectedHeader = new Map();
signedConsistencyProofUnprotectedHeader.set(unprotectedHeader_1.default.consistency_proof, cbor_1.default.encode([
consistency_proof.tree_size_1,

@@ -44,5 +44,5 @@ consistency_proof.tree_size_2,

]));
const updated = unprotectedHeader_1.default.set(signed_root, u);
return updated;
const signedConsistencyProof = unprotectedHeader_1.default.set(signedMerkleRoot, signedConsistencyProofUnprotectedHeader);
return signedConsistencyProof;
});
exports.sign_consistency_proof = sign_consistency_proof;

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

const inclusion_proof = rfc9162_1.CoMETRE.RFC9162_SHA256.inclusion_proof(leaf_index, leaves);
const signed_root = yield signer.sign({
const signedMerkleRoot = yield signer.sign({
protectedHeader: {

@@ -31,4 +31,4 @@ alg,

});
const u = new Map();
u.set(unprotectedHeader_1.default.inclusion_proof, cbor_1.default.encode([
const signedInclusionProofUnprotectedHeader = new Map();
signedInclusionProofUnprotectedHeader.set(unprotectedHeader_1.default.inclusion_proof, cbor_1.default.encode([
inclusion_proof.tree_size,

@@ -38,6 +38,7 @@ inclusion_proof.leaf_index,

]));
const updated = unprotectedHeader_1.default.set(signed_root, u);
const { signature } = yield (0, detachPayload_1.default)(updated);
const signedInclusionProof = unprotectedHeader_1.default.set(signedMerkleRoot, signedInclusionProofUnprotectedHeader);
// TODO: remove this and require a detached signer?
const { signature } = yield (0, detachPayload_1.default)(signedInclusionProof);
return signature;
});
exports.sign_inclusion_proof = sign_inclusion_proof;

@@ -1,5 +0,5 @@

/// <reference types="node" />
import { UnprotectedHeader } from './types';
declare const unprotectedHeader: {
set: (message: Uint8Array, updated: UnprotectedHeader) => Buffer;
get: (message: Uint8Array) => UnprotectedHeader;
set: (message: Uint8Array, unprotectedMap: UnprotectedHeader) => Uint8Array;
kid: number;

@@ -10,3 +10,4 @@ content_type: number;

consistency_proof: number;
receipt: number;
};
export default unprotectedHeader;

@@ -35,8 +35,15 @@ "use strict";

consistency_proof: 200,
// will be registered in https://datatracker.ietf.org/doc/draft-birkholz-scitt-receipts/
receipt: 300 // signed inclusion proof with extra data ... (uses tag 100)
};
const unprotectedHeader = Object.assign(Object.assign({}, unprotectedHeaderTags), { set: (message, updated) => {
const unprotectedHeader = Object.assign(Object.assign({}, unprotectedHeaderTags), { get: (message) => {
const decoded = cbor.decode(message);
decoded.value[1] = updated;
return cbor.encode(decoded);
const unprotectedMap = decoded.value[1];
return unprotectedMap.size === undefined ? new Map() : unprotectedMap;
}, set: (message, unprotectedMap) => {
const decoded = cbor.decode(message);
decoded.value[1] = unprotectedMap;
const updatedMessage = new Uint8Array(cbor.encode(decoded));
return updatedMessage;
} });
exports.default = unprotectedHeader;
{
"name": "@transmute/cose",
"version": "0.0.11",
"version": "0.0.12",
"description": "COSE and related work.",

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

@@ -27,3 +27,3 @@ import { CoMETRE } from '@transmute/rfc9162'

const new_root = CoMETRE.RFC9162_SHA256.root(leaves)
const signed_root = await signer.sign({
const signedMerkleRoot = await signer.sign({
protectedHeader: {

@@ -35,4 +35,4 @@ alg,

})
const u = new Map()
u.set(
const signedConsistencyProofUnprotectedHeader = new Map()
signedConsistencyProofUnprotectedHeader.set(
unprotectedHeader.consistency_proof,

@@ -45,4 +45,4 @@ cbor.encode([

)
const updated = unprotectedHeader.set(signed_root, u)
return updated
const signedConsistencyProof = unprotectedHeader.set(signedMerkleRoot, signedConsistencyProofUnprotectedHeader)
return signedConsistencyProof
}

@@ -18,3 +18,3 @@ import { CoMETRE } from '@transmute/rfc9162'

)
const signed_root = await signer.sign({
const signedMerkleRoot = await signer.sign({
protectedHeader: {

@@ -26,4 +26,4 @@ alg,

})
const u = new Map()
u.set(
const signedInclusionProofUnprotectedHeader = new Map()
signedInclusionProofUnprotectedHeader.set(
unprotectedHeader.inclusion_proof,

@@ -36,5 +36,6 @@ cbor.encode([

)
const updated = unprotectedHeader.set(signed_root, u)
const { signature } = await detachPayload(updated)
const signedInclusionProof = unprotectedHeader.set(signedMerkleRoot, signedInclusionProofUnprotectedHeader)
// TODO: remove this and require a detached signer?
const { signature } = await detachPayload(signedInclusionProof)
return signature
}

@@ -12,2 +12,5 @@ import * as cbor from 'cbor-web'

consistency_proof: 200,
// will be registered in https://datatracker.ietf.org/doc/draft-birkholz-scitt-receipts/
receipt: 300 // signed inclusion proof with extra data ... (uses tag 100)
}

@@ -17,9 +20,15 @@

...unprotectedHeaderTags,
set: (message: Uint8Array, updated: UnprotectedHeader) => {
get: (message: Uint8Array): UnprotectedHeader => {
const decoded = cbor.decode(message)
decoded.value[1] = updated
return cbor.encode(decoded)
const unprotectedMap = decoded.value[1] as UnprotectedHeader
return unprotectedMap.size === undefined ? new Map() : unprotectedMap
},
set: (message: Uint8Array, unprotectedMap: UnprotectedHeader): Uint8Array => {
const decoded = cbor.decode(message)
decoded.value[1] = unprotectedMap
const updatedMessage = new Uint8Array(cbor.encode(decoded))
return updatedMessage
},
}
export default unprotectedHeader
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