samlify 2.10.0 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/.circleci/config.yml +128 -0
  2. package/.github/workflows/deploy-docs.yml +56 -0
  3. package/CHANGELOG.md +7 -0
  4. package/build/index.js +7 -17
  5. package/build/index.js.map +1 -1
  6. package/build/src/api.js +4 -3
  7. package/build/src/api.js.map +1 -1
  8. package/build/src/binding-post.js +15 -25
  9. package/build/src/binding-post.js.map +1 -1
  10. package/build/src/binding-redirect.js +7 -17
  11. package/build/src/binding-redirect.js.map +1 -1
  12. package/build/src/binding-simplesign.js +14 -24
  13. package/build/src/binding-simplesign.js.map +1 -1
  14. package/build/src/entity-idp.js +4 -4
  15. package/build/src/entity-idp.js.map +1 -1
  16. package/build/src/entity-sp.js +2 -2
  17. package/build/src/entity-sp.js.map +1 -1
  18. package/build/src/entity.js +7 -17
  19. package/build/src/entity.js.map +1 -1
  20. package/build/src/extractor.js +2 -2
  21. package/build/src/extractor.js.map +1 -1
  22. package/build/src/flow.js +35 -29
  23. package/build/src/flow.js.map +1 -1
  24. package/build/src/libsaml.js +24 -30
  25. package/build/src/libsaml.js.map +1 -1
  26. package/build/src/metadata-idp.js +9 -9
  27. package/build/src/metadata-idp.js.map +1 -1
  28. package/build/src/metadata-sp.js +9 -9
  29. package/build/src/metadata-sp.js.map +1 -1
  30. package/build/src/metadata.js +7 -17
  31. package/build/src/metadata.js.map +1 -1
  32. package/build/src/urn.js +4 -4
  33. package/build/src/urn.js.map +1 -1
  34. package/build/src/utility.js +13 -12
  35. package/build/src/utility.js.map +1 -1
  36. package/build/src/validator.js +2 -1
  37. package/build/src/validator.js.map +1 -1
  38. package/package.json +12 -21
  39. package/src/flow.ts +24 -23
  40. package/src/libsaml.ts +18 -13
  41. package/tsconfig.json +8 -1
  42. package/types/src/binding-post.d.ts +1 -1
  43. package/types/src/binding-simplesign.d.ts +1 -1
  44. package/types/src/entity.d.ts +2 -1
  45. package/types/src/extractor.d.ts +1 -1
  46. package/types/src/libsaml.d.ts +7 -6
  47. package/types/src/metadata.d.ts +1 -0
  48. package/types/src/types.d.ts +8 -7
  49. package/types/src/utility.d.ts +2 -1
  50. package/types/src/validator.d.ts +1 -1
  51. package/types/vitest.config.d.ts +2 -0
  52. package/vitest.config.ts +12 -0
@@ -6,7 +6,7 @@ interface ExtractorField {
6
6
  attributePath?: string[];
7
7
  context?: boolean;
8
8
  }
9
- export type ExtractorFields = ExtractorField[];
9
+ export declare type ExtractorFields = ExtractorField[];
10
10
  export declare const loginRequestFields: ExtractorFields;
11
11
  export declare const loginResponseStatusFields: {
12
12
  key: string;
@@ -3,6 +3,7 @@
3
3
  * @author tngan
4
4
  * @desc A simple library including some common functions
5
5
  */
6
+ /// <reference types="node" />
6
7
  import { MetadataInterface } from './metadata';
7
8
  export interface SignatureConstructor {
8
9
  rawSamlMessage: string;
@@ -57,7 +58,7 @@ export interface LogoutRequestTemplate extends BaseSamlTemplate {
57
58
  }
58
59
  export interface LogoutResponseTemplate extends BaseSamlTemplate {
59
60
  }
60
- export type KeyUse = 'signing' | 'encryption';
61
+ export declare type KeyUse = 'signing' | 'encryption';
61
62
  export interface KeyComponent {
62
63
  [key: string]: any;
63
64
  }
@@ -85,7 +86,7 @@ export interface LibSamlInterface {
85
86
  defaultLogoutResponseTemplate: LogoutResponseTemplate;
86
87
  }
87
88
  declare const _default: {
88
- createXPath: (local: any, isExtractAll?: boolean) => string;
89
+ createXPath: (local: any, isExtractAll?: boolean | undefined) => string;
89
90
  getQueryParamByType: (type: string) => "SAMLRequest" | "SAMLResponse";
90
91
  defaultLoginRequestTemplate: {
91
92
  context: string;
@@ -149,7 +150,7 @@ declare const _default: {
149
150
  * - The first element is `true` if the signature is valid, `false` otherwise.
150
151
  * - The second element is the cryptographically authenticated assertion node as a string, or `null` if not found.
151
152
  */
152
- verifySignature(xml: string, opts: SignatureVerifierOptions): (string | boolean)[] | (boolean | null)[];
153
+ verifySignature(xml: string, opts: SignatureVerifierOptions): [boolean, string | null];
153
154
  /**
154
155
  * @desc Helper function to create the key section in metadata (abstraction for signing and encrypt use)
155
156
  * @param {string} use type of certificate (e.g. signing, encrypt)
@@ -165,7 +166,7 @@ declare const _default: {
165
166
  * @param {string} signingAlgorithm signing algorithm
166
167
  * @return {string} message signature
167
168
  */
168
- constructMessageSignature(octetString: string, key: string, passphrase?: string, isBase64?: boolean, signingAlgorithm?: string): string | Buffer;
169
+ constructMessageSignature(octetString: string, key: string, passphrase?: string | undefined, isBase64?: boolean | undefined, signingAlgorithm?: string | undefined): string | Buffer;
169
170
  /**
170
171
  * @desc Verifies message signature
171
172
  * @param {Metadata} metadata metadata object of identity provider or service provider
@@ -174,7 +175,7 @@ declare const _default: {
174
175
  * @param {string} verifyAlgorithm algorithm used to verify
175
176
  * @return {boolean} verification result
176
177
  */
177
- verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string): boolean;
178
+ verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string | undefined): boolean;
178
179
  /**
179
180
  * @desc Get the public key in string format
180
181
  * @param {string} x509Certificate certificate
@@ -191,7 +192,7 @@ declare const _default: {
191
192
  * @param {string} xml response in xml string format
192
193
  * @return {Promise} a promise to resolve the finalized xml
193
194
  */
194
- encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string): Promise<string>;
195
+ encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string | undefined): Promise<string>;
195
196
  /**
196
197
  * @desc Decrypt the assertion section in Response
197
198
  * @param {string} type only accept SAMLResponse to proceed decryption
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  export interface MetadataInterface {
2
3
  xmlString: string;
3
4
  getMetadata: () => string;
@@ -1,10 +1,11 @@
1
+ /// <reference types="node" />
1
2
  import { LoginResponseTemplate } from './libsaml';
2
3
  export { IdentityProvider as IdentityProviderConstructor } from './entity-idp';
3
4
  export { IdpMetadata as IdentityProviderMetadata } from './metadata-idp';
4
5
  export { ServiceProvider as ServiceProviderConstructor } from './entity-sp';
5
6
  export { SpMetadata as ServiceProviderMetadata } from './metadata-sp';
6
- export type MetadataFile = string | Buffer;
7
- type SSOService = {
7
+ export declare type MetadataFile = string | Buffer;
8
+ declare type SSOService = {
8
9
  isDefault?: boolean;
9
10
  Binding: string;
10
11
  Location: string;
@@ -19,7 +20,7 @@ export interface MetadataIdpOptions {
19
20
  singleLogoutService?: SSOService[];
20
21
  requestSignatureAlgorithm?: string;
21
22
  }
22
- export type MetadataIdpConstructor = MetadataIdpOptions | MetadataFile;
23
+ export declare type MetadataIdpConstructor = MetadataIdpOptions | MetadataFile;
23
24
  export interface MetadataSpOptions {
24
25
  entityID?: string;
25
26
  signingCert?: string | Buffer | (string | Buffer)[];
@@ -36,8 +37,8 @@ export interface MetadataSpOptions {
36
37
  assertionConsumerService?: SSOService[];
37
38
  elementsOrder?: string[];
38
39
  }
39
- export type MetadataSpConstructor = MetadataSpOptions | MetadataFile;
40
- export type EntitySetting = ServiceProviderSettings & IdentityProviderSettings;
40
+ export declare type MetadataSpConstructor = MetadataSpOptions | MetadataFile;
41
+ export declare type EntitySetting = ServiceProviderSettings & IdentityProviderSettings;
41
42
  export interface SignatureConfig {
42
43
  prefix?: string;
43
44
  location?: {
@@ -48,7 +49,7 @@ export interface SignatureConfig {
48
49
  export interface SAMLDocumentTemplate {
49
50
  context?: string;
50
51
  }
51
- export type ServiceProviderSettings = {
52
+ export declare type ServiceProviderSettings = {
52
53
  metadata?: string | Buffer;
53
54
  entityID?: string;
54
55
  authnRequestsSigned?: boolean;
@@ -75,7 +76,7 @@ export type ServiceProviderSettings = {
75
76
  relayState?: string;
76
77
  clockDrifts?: [number, number];
77
78
  };
78
- export type IdentityProviderSettings = {
79
+ export declare type IdentityProviderSettings = {
79
80
  metadata?: string | Buffer;
80
81
  /** signature algorithm */
81
82
  requestSignatureAlgorithm?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  /**
2
3
  * @desc Mimic lodash.zipObject
3
4
  * @param arr1 {string[]}
@@ -34,7 +35,7 @@ export declare function get(obj: any, path: any, defaultValue: any): any;
34
35
  * @desc Check if the input is string
35
36
  * @param {any} input
36
37
  */
37
- export declare function isString(input: any): input is string;
38
+ export declare function isString(input: any): boolean;
38
39
  /**
39
40
  * @desc Encode string with base64 format
40
41
  * @param {string} message plain-text message
@@ -1,3 +1,3 @@
1
- type DriftTolerance = [number, number];
1
+ declare type DriftTolerance = [number, number];
2
2
  declare function verifyTime(utcNotBefore: string | undefined, utcNotOnOrAfter: string | undefined, drift?: DriftTolerance): boolean;
3
3
  export { verifyTime };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ['test/**/*.ts'],
6
+ exclude: ['node_modules', 'build'],
7
+ globals: true,
8
+ environment: 'node',
9
+ },
10
+ })
11
+
12
+