New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sd-jwt/types

Package Overview
Dependencies
Maintainers
2
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sd-jwt/types - npm Package Compare versions

Comparing version 0.3.2-next.109 to 0.3.2-next.110

49

dist/index.d.ts

@@ -132,3 +132,50 @@ declare const SD_SEPARATOR = "~";

type DisclosureFrame<T extends object> = Frame<T>;
/**
* This is a presentationFrame type that is used to represent the structure of what is being presented.
* PresentationFrame is made from the payload type.
* const claims = {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
id: '1234',
data: {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
list: [{ r: 'd' }, 'b', 'c'],
list2: ['1', '2', '3'],
list3: ['1', null, 2],
},
data2: {
hi: 'bye',
},
};
export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };
Example of a presentationFrame:
const presentationFrame: PresentationFrame<typeof claims> = {
firstname: true,
lastname: true,
ssn: true,
id: 'true',
data: {
firstname: true,
list: {
1: true,
0: {
r: true,
},
},
list2: {
1: true,
},
list3: true,
},
data2: true,
};
*/
type PFrame<Payload> = Payload extends Array<infer U> ? U extends object ? Record<number, PFrame<U> | boolean> | boolean : Record<number, boolean> | boolean : {
[K in keyof Payload]?: Payload[K] extends object ? PFrame<Payload[K]> | boolean : boolean;
};
type PresentationFrame<T extends object> = PFrame<T>;
export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type PresentationFrame, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };

4

package.json
{
"name": "@sd-jwt/types",
"version": "0.3.2-next.109+f02d6b0",
"version": "0.3.2-next.110+10aa828",
"description": "sd-jwt draft 7 implementation in typescript",

@@ -56,3 +56,3 @@ "main": "dist/index.js",

},
"gitHead": "f02d6b093dd8105560ba327c23c0f383e92d31c7"
"gitHead": "10aa828afa2b75787459bfde444a8e4d318825f9"
}

@@ -8,4 +8,24 @@ import { describe, expect, test } from 'vitest';

KB_JWT_TYP,
DisclosureFrame,
PresentationFrame,
} from '../index';
const claims = {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
id: '1234',
data: {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
list: [{ r: 'd' }, 'b', 'c'],
list2: ['1', '2', '3'],
list3: ['1', null, 2],
},
data2: {
hi: 'bye',
},
};
describe('Variable tests', () => {

@@ -31,2 +51,40 @@ test('SD_SEPARATOR', () => {

});
test('DisclosureFrameType test', () => {
const disclosureFrame: DisclosureFrame<typeof claims> = {
_sd: ['data', 'firstname', 'data2'],
data: {
_sd: ['list', 'ssn'],
_sd_decoy: 2,
list: {
_sd: [0, 2],
0: {
_sd: ['r'],
},
},
},
};
expect(disclosureFrame).toBeDefined();
});
test('PresentationFrameType test', () => {
const presentationFrame: PresentationFrame<typeof claims> = {
firstname: true,
data: {
firstname: true,
list: {
1: true,
0: {
r: true,
},
},
list2: {
1: true,
},
list3: true,
},
data2: true,
};
expect(presentationFrame).toBeDefined();
});
});

@@ -157,1 +157,56 @@ export const SD_SEPARATOR = '~';

export type DisclosureFrame<T extends object> = Frame<T>;
/**
* This is a presentationFrame type that is used to represent the structure of what is being presented.
* PresentationFrame is made from the payload type.
* const claims = {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
id: '1234',
data: {
firstname: 'John',
lastname: 'Doe',
ssn: '123-45-6789',
list: [{ r: 'd' }, 'b', 'c'],
list2: ['1', '2', '3'],
list3: ['1', null, 2],
},
data2: {
hi: 'bye',
},
};
Example of a presentationFrame:
const presentationFrame: PresentationFrame<typeof claims> = {
firstname: true,
lastname: true,
ssn: true,
id: 'true',
data: {
firstname: true,
list: {
1: true,
0: {
r: true,
},
},
list2: {
1: true,
},
list3: true,
},
data2: true,
};
*/
type PFrame<Payload> = Payload extends Array<infer U>
? U extends object
? Record<number, PFrame<U> | boolean> | boolean
: Record<number, boolean> | boolean
: {
[K in keyof Payload]?: Payload[K] extends object
? PFrame<Payload[K]> | boolean
: boolean;
};
export type PresentationFrame<T extends object> = PFrame<T>;

Sorry, the diff of this file is not supported yet

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