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.7 to 0.0.8

dist/detached/index.d.ts

2

dist/attachPayload.d.ts
import { DetachedSignature } from './types/DetachedSignature';
declare const attachPayload: ({ payload, signature }: DetachedSignature) => Uint8Array;
declare const attachPayload: ({ payload, signature }: DetachedSignature) => Promise<Uint8Array>;
export default attachPayload;

@@ -25,9 +25,18 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const cbor = __importStar(require("cbor-web"));
const attachPayload = ({ payload, signature }) => {
const decoded = cbor.decode(signature);
const attachPayload = ({ payload, signature }) => __awaiter(void 0, void 0, void 0, function* () {
const decoded = cbor.decodeFirstSync(signature);
decoded.value[2] = payload;
return new Uint8Array(cbor.encode(decoded));
};
return new Uint8Array(yield cbor.encodeAsync(decoded));
});
exports.default = attachPayload;
import { DetachedSignature } from './types/DetachedSignature';
declare const detachPayload: (attachedSignature: Uint8Array) => DetachedSignature;
declare const detachPayload: (attachedSignature: Uint8Array) => Promise<DetachedSignature>;
export default detachPayload;

@@ -25,12 +25,21 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const cbor = __importStar(require("cbor-web"));
const detachPayload = (attachedSignature) => {
const decoded = cbor.decode(attachedSignature);
const detachPayload = (attachedSignature) => __awaiter(void 0, void 0, void 0, function* () {
const decoded = cbor.decodeFirstSync(attachedSignature);
const payload = decoded.value[2];
decoded.value[2] = new Uint8Array();
cbor.encode(decoded);
const signature = new Uint8Array(cbor.encode(decoded));
const signature = new Uint8Array(yield cbor.encodeAsync(decoded));
return { payload, signature };
};
});
exports.default = detachPayload;
/// <reference types="node" />
declare const cose: {
detached: {
signer: ({ privateKeyJwk }: {
privateKeyJwk: import("./types").PrivateKeyJwk;
}) => Promise<{
alg: string;
sign: ({ protectedHeader, unprotectedHeader, payload, }: {
protectedHeader: import("./types").ProtectedHeader;
unprotectedHeader?: import("./types").UnprotectedHeader | undefined;
payload: Uint8Array;
}) => Promise<import("./types/DetachedSignature").DetachedSignature>;
}>;
verifier: ({ publicKeyJwk }: {
publicKeyJwk: import("./types").PublicKeyJwk;
}) => Promise<{
verify: ({ payload, signature }: {
payload: Uint8Array;
signature: Uint8Array;
}) => Promise<boolean>;
}>;
};
binToHex: (bytes: any) => any;

@@ -23,4 +43,4 @@ hexToBin: (hexString: string) => Uint8Array;

}) => Promise<string>;
detachPayload: (attachedSignature: Uint8Array) => import("./types/DetachedSignature").DetachedSignature;
attachPayload: ({ payload, signature }: import("./types/DetachedSignature").DetachedSignature) => Uint8Array;
detachPayload: (attachedSignature: Uint8Array) => Promise<import("./types/DetachedSignature").DetachedSignature>;
attachPayload: ({ payload, signature }: import("./types/DetachedSignature").DetachedSignature) => Promise<Uint8Array>;
unprotectedHeader: {

@@ -27,0 +47,0 @@ set: (message: Uint8Array, updated: import("./types").UnprotectedHeader) => Buffer;

@@ -28,4 +28,6 @@ "use strict";

const attachPayload_1 = __importDefault(require("./attachPayload"));
const detached_1 = __importDefault(require("./detached"));
const rfc9162_1 = require("@transmute/rfc9162");
const cose = {
detached: detached_1.default,
binToHex: rfc9162_1.RFC9162.binToHex,

@@ -32,0 +34,0 @@ hexToBin: rfc9162_1.RFC9162.hexToBin,

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

const updated = unprotectedHeader_1.default.set(signed_root, u);
const { signature } = (0, detachPayload_1.default)(updated);
const { signature } = yield (0, detachPayload_1.default)(updated);
return signature;
});
exports.sign_inclusion_proof = sign_inclusion_proof;

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

});
const attached = (0, attachPayload_1.default)({
const attached = yield (0, attachPayload_1.default)({
signature: signed_inclusion_proof,

@@ -31,0 +31,0 @@ payload: validated_root

@@ -13,1 +13,3 @@ export * from './ProtectedHeader';

export * from './RequestInclusionProofVerification';
export * from './CoseDetachedSigner';
export * from './CoseDetachedVerifier';

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

__exportStar(require("./RequestInclusionProofVerification"), exports);
__exportStar(require("./CoseDetachedSigner"), exports);
__exportStar(require("./CoseDetachedVerifier"), exports);
{
"name": "@transmute/cose",
"version": "0.0.7",
"version": "0.0.8",
"description": "COSE and related work.",

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

@@ -6,8 +6,8 @@ import * as cbor from 'cbor-web'

const attachPayload = ({ payload, signature }: DetachedSignature): Uint8Array => {
const decoded = cbor.decode(signature)
const attachPayload = async ({ payload, signature }: DetachedSignature): Promise<Uint8Array> => {
const decoded = cbor.decodeFirstSync(signature)
decoded.value[2] = payload
return new Uint8Array(cbor.encode(decoded))
return new Uint8Array(await cbor.encodeAsync(decoded))
}
export default attachPayload

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

const detachPayload = (attachedSignature: Uint8Array): DetachedSignature => {
const decoded = cbor.decode(attachedSignature)
const detachPayload = async (attachedSignature: Uint8Array): Promise<DetachedSignature> => {
const decoded = cbor.decodeFirstSync(attachedSignature)
const payload = decoded.value[2]
decoded.value[2] = new Uint8Array()
cbor.encode(decoded)
const signature = new Uint8Array(cbor.encode(decoded))
const signature = new Uint8Array(await cbor.encodeAsync(decoded))
return { payload, signature }

@@ -13,0 +13,0 @@ }

@@ -10,5 +10,8 @@ import signer from './signer'

import detached from './detached'
import { RFC9162 } from '@transmute/rfc9162'
const cose = {
detached,
binToHex: RFC9162.binToHex,

@@ -15,0 +18,0 @@ hexToBin: RFC9162.hexToBin,

@@ -35,4 +35,4 @@ import { CoMETRE } from '@transmute/rfc9162'

const updated = unprotectedHeader.set(signed_root, u)
const { signature } = detachPayload(updated)
const { signature } = await detachPayload(updated)
return signature
}

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

)
const attached = attachPayload({
const attached = await attachPayload({
signature: signed_inclusion_proof,

@@ -27,0 +27,0 @@ payload: validated_root

@@ -13,1 +13,3 @@ export * from './ProtectedHeader'

export * from './RequestInclusionProofVerification'
export * from './CoseDetachedSigner'
export * from './CoseDetachedVerifier'
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