@sphereon/ssi-sdk.siopv2-oid4vp-common 0.33.1-next.2 → 0.33.1-next.68
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.
- package/dist/index.cjs +60 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -7
- package/dist/index.js +37 -33
- package/dist/index.js.map +1 -1
- package/package.json +27 -12
- package/src/auth-model.ts +33 -0
- package/src/index.ts +26 -0
- package/src/utils.ts +10 -0
- package/dist/auth-model.d.ts +0 -27
- package/dist/auth-model.d.ts.map +0 -1
- package/dist/auth-model.js +0 -3
- package/dist/auth-model.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -16
- package/dist/utils.js.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
AuthorizationRequest: () => import_did_auth_siop.AuthorizationRequest,
|
|
25
|
+
AuthorizationRequestPayload: () => import_did_auth_siop.AuthorizationRequestPayload,
|
|
26
|
+
AuthorizationRequestState: () => import_did_auth_siop.AuthorizationRequestState,
|
|
27
|
+
AuthorizationResponse: () => import_did_auth_siop.AuthorizationResponse,
|
|
28
|
+
AuthorizationResponsePayload: () => import_did_auth_siop.AuthorizationResponsePayload,
|
|
29
|
+
OP: () => import_did_auth_siop.OP,
|
|
30
|
+
OPBuilder: () => import_did_auth_siop.OPBuilder,
|
|
31
|
+
PresentationDefinitionWithLocation: () => import_did_auth_siop.PresentationDefinitionWithLocation,
|
|
32
|
+
PresentationVerificationCallback: () => import_did_auth_siop.PresentationVerificationCallback,
|
|
33
|
+
PresentationVerificationResult: () => import_did_auth_siop.PresentationVerificationResult,
|
|
34
|
+
RP: () => import_did_auth_siop.RP,
|
|
35
|
+
RequestObjectPayload: () => import_did_auth_siop.RequestObjectPayload,
|
|
36
|
+
SupportedVersion: () => import_did_auth_siop.SupportedVersion,
|
|
37
|
+
URI: () => import_did_auth_siop.URI,
|
|
38
|
+
VPTokenLocation: () => import_did_auth_siop.VPTokenLocation,
|
|
39
|
+
decodeUriAsJson: () => import_did_auth_siop.decodeUriAsJson,
|
|
40
|
+
encodeJsonAsURI: () => import_did_auth_siop.encodeJsonAsURI,
|
|
41
|
+
uriWithBase: () => uriWithBase
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
|
|
45
|
+
// src/utils.ts
|
|
46
|
+
function uriWithBase(path, opts) {
|
|
47
|
+
let baseUri = `${!!opts?.baseURI ? opts.baseURI : opts?.envVarName && process ? process.env[opts.envVarName] : process?.env?.BACKEND_BASE_URI}`;
|
|
48
|
+
if (!baseUri || baseUri === "undefined") {
|
|
49
|
+
throw Error("No base URI provided as param or environment variable");
|
|
50
|
+
} else if (!baseUri.startsWith("http")) {
|
|
51
|
+
throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`);
|
|
52
|
+
}
|
|
53
|
+
baseUri = baseUri.endsWith("/") ? baseUri.substring(0, baseUri.length - 1) : baseUri;
|
|
54
|
+
return `${baseUri}${path.startsWith("/") ? path : "/" + path}`;
|
|
55
|
+
}
|
|
56
|
+
__name(uriWithBase, "uriWithBase");
|
|
57
|
+
|
|
58
|
+
// src/index.ts
|
|
59
|
+
var import_did_auth_siop = require("@sphereon/did-auth-siop");
|
|
60
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils.ts"],"sourcesContent":["export * from './auth-model'\nexport * from './utils'\n\n// We are exporting some common class from SIOP\n/**\n * @private\n */\nexport {\n decodeUriAsJson,\n encodeJsonAsURI,\n AuthorizationResponsePayload,\n AuthorizationRequestPayload,\n URI,\n AuthorizationRequestState,\n RequestObjectPayload,\n AuthorizationRequest,\n AuthorizationResponse,\n RP,\n OP,\n OPBuilder,\n SupportedVersion,\n PresentationDefinitionWithLocation,\n PresentationVerificationResult,\n PresentationVerificationCallback,\n VPTokenLocation,\n} from '@sphereon/did-auth-siop'\n","export function uriWithBase(path: string, opts?: { baseURI?: string; envVarName?: string }) {\n let baseUri = `${!!opts?.baseURI ? opts.baseURI : opts?.envVarName && process ? process.env[opts.envVarName!] : process?.env?.BACKEND_BASE_URI}`\n if (!baseUri || baseUri === 'undefined') {\n throw Error('No base URI provided as param or environment variable')\n } else if (!baseUri.startsWith('http')) {\n throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`)\n }\n baseUri = baseUri.endsWith('/') ? baseUri.substring(0, baseUri.length - 1) : baseUri\n return `${baseUri}${path.startsWith('/') ? path : '/' + path}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;ACAO,SAASA,YAAYC,MAAcC,MAAgD;AACxF,MAAIC,UAAU,GAAG,CAAC,CAACD,MAAME,UAAUF,KAAKE,UAAUF,MAAMG,cAAcC,UAAUA,QAAQC,IAAIL,KAAKG,UAAU,IAAKC,SAASC,KAAKC,gBAAAA;AAC9H,MAAI,CAACL,WAAWA,YAAY,aAAa;AACvC,UAAMM,MAAM,uDAAA;EACd,WAAW,CAACN,QAAQO,WAAW,MAAA,GAAS;AACtC,UAAMD,MAAM,mDAAmDN,OAAAA,EAAS;EAC1E;AACAA,YAAUA,QAAQQ,SAAS,GAAA,IAAOR,QAAQS,UAAU,GAAGT,QAAQU,SAAS,CAAA,IAAKV;AAC7E,SAAO,GAAGA,OAAAA,GAAUF,KAAKS,WAAW,GAAA,IAAOT,OAAO,MAAMA,IAAAA;AAC1D;AATgBD;;;ADOhB,2BAkBO;","names":["uriWithBase","path","opts","baseUri","baseURI","envVarName","process","env","BACKEND_BASE_URI","Error","startsWith","endsWith","substring","length"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop';
|
|
2
|
+
export { AuthorizationRequest, AuthorizationRequestPayload, AuthorizationRequestState, AuthorizationResponse, AuthorizationResponsePayload, OP, OPBuilder, PresentationDefinitionWithLocation, PresentationVerificationCallback, PresentationVerificationResult, RP, RequestObjectPayload, SupportedVersion, URI, VPTokenLocation, decodeUriAsJson, encodeJsonAsURI } from '@sphereon/did-auth-siop';
|
|
3
|
+
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
4
|
+
|
|
5
|
+
interface ClaimPayloadCommonOpts {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface AuthorizationChallengeValidationResponse {
|
|
9
|
+
presentation_during_issuance_session: string;
|
|
10
|
+
}
|
|
11
|
+
type AuthorizationRequestStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
12
|
+
type AuthorizationResponseStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
13
|
+
interface GenerateAuthRequestURIResponse {
|
|
14
|
+
correlationId: string;
|
|
15
|
+
state: string;
|
|
16
|
+
definitionId: string;
|
|
17
|
+
authRequestURI: string;
|
|
18
|
+
authStatusURI: string;
|
|
19
|
+
}
|
|
20
|
+
interface AuthStatusResponse {
|
|
21
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
22
|
+
correlationId: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
definitionId: string;
|
|
25
|
+
lastUpdated: number;
|
|
26
|
+
payload?: AuthorizationResponsePayload;
|
|
27
|
+
verifiedData?: AdditionalClaims;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare function uriWithBase(path: string, opts?: {
|
|
31
|
+
baseURI?: string;
|
|
32
|
+
envVarName?: string;
|
|
33
|
+
}): string;
|
|
34
|
+
|
|
35
|
+
export { type AuthStatusResponse, type AuthorizationChallengeValidationResponse, type AuthorizationRequestStateStatus, type AuthorizationResponseStateStatus, type ClaimPayloadCommonOpts, type GenerateAuthRequestURIResponse, uriWithBase };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop';
|
|
2
|
+
export { AuthorizationRequest, AuthorizationRequestPayload, AuthorizationRequestState, AuthorizationResponse, AuthorizationResponsePayload, OP, OPBuilder, PresentationDefinitionWithLocation, PresentationVerificationCallback, PresentationVerificationResult, RP, RequestObjectPayload, SupportedVersion, URI, VPTokenLocation, decodeUriAsJson, encodeJsonAsURI } from '@sphereon/did-auth-siop';
|
|
3
|
+
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
4
|
+
|
|
5
|
+
interface ClaimPayloadCommonOpts {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface AuthorizationChallengeValidationResponse {
|
|
9
|
+
presentation_during_issuance_session: string;
|
|
10
|
+
}
|
|
11
|
+
type AuthorizationRequestStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
12
|
+
type AuthorizationResponseStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
13
|
+
interface GenerateAuthRequestURIResponse {
|
|
14
|
+
correlationId: string;
|
|
15
|
+
state: string;
|
|
16
|
+
definitionId: string;
|
|
17
|
+
authRequestURI: string;
|
|
18
|
+
authStatusURI: string;
|
|
19
|
+
}
|
|
20
|
+
interface AuthStatusResponse {
|
|
21
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
22
|
+
correlationId: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
definitionId: string;
|
|
25
|
+
lastUpdated: number;
|
|
26
|
+
payload?: AuthorizationResponsePayload;
|
|
27
|
+
verifiedData?: AdditionalClaims;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare function uriWithBase(path: string, opts?: {
|
|
31
|
+
baseURI?: string;
|
|
32
|
+
envVarName?: string;
|
|
33
|
+
}): string;
|
|
34
|
+
|
|
35
|
+
export { type AuthStatusResponse, type AuthorizationChallengeValidationResponse, type AuthorizationRequestStateStatus, type AuthorizationResponseStateStatus, type ClaimPayloadCommonOpts, type GenerateAuthRequestURIResponse, uriWithBase };
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/utils.ts
|
|
5
|
+
function uriWithBase(path, opts) {
|
|
6
|
+
let baseUri = `${!!opts?.baseURI ? opts.baseURI : opts?.envVarName && process ? process.env[opts.envVarName] : process?.env?.BACKEND_BASE_URI}`;
|
|
7
|
+
if (!baseUri || baseUri === "undefined") {
|
|
8
|
+
throw Error("No base URI provided as param or environment variable");
|
|
9
|
+
} else if (!baseUri.startsWith("http")) {
|
|
10
|
+
throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`);
|
|
11
|
+
}
|
|
12
|
+
baseUri = baseUri.endsWith("/") ? baseUri.substring(0, baseUri.length - 1) : baseUri;
|
|
13
|
+
return `${baseUri}${path.startsWith("/") ? path : "/" + path}`;
|
|
14
|
+
}
|
|
15
|
+
__name(uriWithBase, "uriWithBase");
|
|
16
|
+
|
|
17
|
+
// src/index.ts
|
|
18
|
+
import { decodeUriAsJson, encodeJsonAsURI, AuthorizationResponsePayload, AuthorizationRequestPayload, URI, AuthorizationRequestState, RequestObjectPayload, AuthorizationRequest, AuthorizationResponse, RP, OP, OPBuilder, SupportedVersion, PresentationDefinitionWithLocation, PresentationVerificationResult, PresentationVerificationCallback, VPTokenLocation } from "@sphereon/did-auth-siop";
|
|
19
|
+
export {
|
|
20
|
+
AuthorizationRequest,
|
|
21
|
+
AuthorizationRequestPayload,
|
|
22
|
+
AuthorizationRequestState,
|
|
23
|
+
AuthorizationResponse,
|
|
24
|
+
AuthorizationResponsePayload,
|
|
25
|
+
OP,
|
|
26
|
+
OPBuilder,
|
|
27
|
+
PresentationDefinitionWithLocation,
|
|
28
|
+
PresentationVerificationCallback,
|
|
29
|
+
PresentationVerificationResult,
|
|
30
|
+
RP,
|
|
31
|
+
RequestObjectPayload,
|
|
32
|
+
SupportedVersion,
|
|
33
|
+
URI,
|
|
34
|
+
VPTokenLocation,
|
|
35
|
+
decodeUriAsJson,
|
|
36
|
+
encodeJsonAsURI,
|
|
37
|
+
uriWithBase
|
|
15
38
|
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.VPTokenLocation = exports.SupportedVersion = exports.OPBuilder = exports.OP = exports.RP = exports.AuthorizationResponse = exports.AuthorizationRequest = exports.URI = exports.encodeJsonAsURI = exports.decodeUriAsJson = void 0;
|
|
18
|
-
__exportStar(require("./auth-model"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
20
|
-
// We are exporting some common class from SIOP
|
|
21
|
-
/**
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
24
|
-
var did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
25
|
-
Object.defineProperty(exports, "decodeUriAsJson", { enumerable: true, get: function () { return did_auth_siop_1.decodeUriAsJson; } });
|
|
26
|
-
Object.defineProperty(exports, "encodeJsonAsURI", { enumerable: true, get: function () { return did_auth_siop_1.encodeJsonAsURI; } });
|
|
27
|
-
Object.defineProperty(exports, "URI", { enumerable: true, get: function () { return did_auth_siop_1.URI; } });
|
|
28
|
-
Object.defineProperty(exports, "AuthorizationRequest", { enumerable: true, get: function () { return did_auth_siop_1.AuthorizationRequest; } });
|
|
29
|
-
Object.defineProperty(exports, "AuthorizationResponse", { enumerable: true, get: function () { return did_auth_siop_1.AuthorizationResponse; } });
|
|
30
|
-
Object.defineProperty(exports, "RP", { enumerable: true, get: function () { return did_auth_siop_1.RP; } });
|
|
31
|
-
Object.defineProperty(exports, "OP", { enumerable: true, get: function () { return did_auth_siop_1.OP; } });
|
|
32
|
-
Object.defineProperty(exports, "OPBuilder", { enumerable: true, get: function () { return did_auth_siop_1.OPBuilder; } });
|
|
33
|
-
Object.defineProperty(exports, "SupportedVersion", { enumerable: true, get: function () { return did_auth_siop_1.SupportedVersion; } });
|
|
34
|
-
Object.defineProperty(exports, "VPTokenLocation", { enumerable: true, get: function () { return did_auth_siop_1.VPTokenLocation; } });
|
|
35
39
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/index.ts"],"sourcesContent":["export function uriWithBase(path: string, opts?: { baseURI?: string; envVarName?: string }) {\n let baseUri = `${!!opts?.baseURI ? opts.baseURI : opts?.envVarName && process ? process.env[opts.envVarName!] : process?.env?.BACKEND_BASE_URI}`\n if (!baseUri || baseUri === 'undefined') {\n throw Error('No base URI provided as param or environment variable')\n } else if (!baseUri.startsWith('http')) {\n throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`)\n }\n baseUri = baseUri.endsWith('/') ? baseUri.substring(0, baseUri.length - 1) : baseUri\n return `${baseUri}${path.startsWith('/') ? path : '/' + path}`\n}\n","export * from './auth-model'\nexport * from './utils'\n\n// We are exporting some common class from SIOP\n/**\n * @private\n */\nexport {\n decodeUriAsJson,\n encodeJsonAsURI,\n AuthorizationResponsePayload,\n AuthorizationRequestPayload,\n URI,\n AuthorizationRequestState,\n RequestObjectPayload,\n AuthorizationRequest,\n AuthorizationResponse,\n RP,\n OP,\n OPBuilder,\n SupportedVersion,\n PresentationDefinitionWithLocation,\n PresentationVerificationResult,\n PresentationVerificationCallback,\n VPTokenLocation,\n} from '@sphereon/did-auth-siop'\n"],"mappings":";;;;AAAO,SAASA,YAAYC,MAAcC,MAAgD;AACxF,MAAIC,UAAU,GAAG,CAAC,CAACD,MAAME,UAAUF,KAAKE,UAAUF,MAAMG,cAAcC,UAAUA,QAAQC,IAAIL,KAAKG,UAAU,IAAKC,SAASC,KAAKC,gBAAAA;AAC9H,MAAI,CAACL,WAAWA,YAAY,aAAa;AACvC,UAAMM,MAAM,uDAAA;EACd,WAAW,CAACN,QAAQO,WAAW,MAAA,GAAS;AACtC,UAAMD,MAAM,mDAAmDN,OAAAA,EAAS;EAC1E;AACAA,YAAUA,QAAQQ,SAAS,GAAA,IAAOR,QAAQS,UAAU,GAAGT,QAAQU,SAAS,CAAA,IAAKV;AAC7E,SAAO,GAAGA,OAAAA,GAAUF,KAAKS,WAAW,GAAA,IAAOT,OAAO,MAAMA,IAAAA;AAC1D;AATgBD;;;ACOhB,SACEc,iBACAC,iBACAC,8BACAC,6BACAC,KACAC,2BACAC,sBACAC,sBACAC,uBACAC,IACAC,IACAC,WACAC,kBACAC,oCACAC,gCACAC,kCACAC,uBACK;","names":["uriWithBase","path","opts","baseUri","baseURI","envVarName","process","env","BACKEND_BASE_URI","Error","startsWith","endsWith","substring","length","decodeUriAsJson","encodeJsonAsURI","AuthorizationResponsePayload","AuthorizationRequestPayload","URI","AuthorizationRequestState","RequestObjectPayload","AuthorizationRequest","AuthorizationResponse","RP","OP","OPBuilder","SupportedVersion","PresentationDefinitionWithLocation","PresentationVerificationResult","PresentationVerificationCallback","VPTokenLocation"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-common",
|
|
3
|
-
"version": "0.33.1-next.
|
|
3
|
+
"version": "0.33.1-next.68+b6c8b366",
|
|
4
4
|
"description": "Common SIOPv2 and OID4VP types between modules",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"react-native": "./dist/index.js",
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
8
21
|
"author": "Sphereon <dev@sphereon.com>",
|
|
9
22
|
"license": "Apache-2.0",
|
|
10
23
|
"private": false,
|
|
@@ -12,21 +25,23 @@
|
|
|
12
25
|
"access": "public"
|
|
13
26
|
},
|
|
14
27
|
"dependencies": {
|
|
15
|
-
"@sphereon/did-auth-siop": "0.17.
|
|
16
|
-
"@sphereon/ssi-sdk.core": "0.33.1-next.
|
|
17
|
-
"@sphereon/ssi-types": "0.33.1-next.
|
|
18
|
-
"uint8arrays": "3.1.1"
|
|
28
|
+
"@sphereon/did-auth-siop": "0.17.1-next.39",
|
|
29
|
+
"@sphereon/ssi-sdk.core": "0.33.1-next.68+b6c8b366",
|
|
30
|
+
"@sphereon/ssi-types": "0.33.1-next.68+b6c8b366",
|
|
31
|
+
"uint8arrays": "^3.1.1"
|
|
19
32
|
},
|
|
20
33
|
"scripts": {
|
|
21
|
-
"build": "
|
|
34
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
|
|
22
35
|
},
|
|
23
36
|
"devDependencies": {
|
|
24
37
|
"@types/node": "^20.17.1",
|
|
25
|
-
"typeorm": "
|
|
38
|
+
"typeorm": "0.3.20"
|
|
26
39
|
},
|
|
27
40
|
"files": [
|
|
28
|
-
"
|
|
41
|
+
"src",
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE"
|
|
29
45
|
],
|
|
30
|
-
"
|
|
31
|
-
"gitHead": "6f7f40b94beb385369fede046c3912bd0c053408"
|
|
46
|
+
"gitHead": "b6c8b36636fa3777494f55860d6a75f2e5a5611e"
|
|
32
47
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
|
+
import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop'
|
|
3
|
+
import { AdditionalClaims } from '@sphereon/ssi-types'
|
|
4
|
+
|
|
5
|
+
export interface ClaimPayloadCommonOpts {
|
|
6
|
+
[x: string]: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AuthorizationChallengeValidationResponse {
|
|
10
|
+
presentation_during_issuance_session: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AuthorizationRequestStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error'
|
|
14
|
+
|
|
15
|
+
export type AuthorizationResponseStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error'
|
|
16
|
+
|
|
17
|
+
export interface GenerateAuthRequestURIResponse {
|
|
18
|
+
correlationId: string
|
|
19
|
+
state: string
|
|
20
|
+
definitionId: string
|
|
21
|
+
authRequestURI: string
|
|
22
|
+
authStatusURI: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AuthStatusResponse {
|
|
26
|
+
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus
|
|
27
|
+
correlationId: string
|
|
28
|
+
error?: string
|
|
29
|
+
definitionId: string
|
|
30
|
+
lastUpdated: number
|
|
31
|
+
payload?: AuthorizationResponsePayload // Only put in here once the status reaches Verified on the RP side
|
|
32
|
+
verifiedData?: AdditionalClaims
|
|
33
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from './auth-model'
|
|
2
|
+
export * from './utils'
|
|
3
|
+
|
|
4
|
+
// We are exporting some common class from SIOP
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export {
|
|
9
|
+
decodeUriAsJson,
|
|
10
|
+
encodeJsonAsURI,
|
|
11
|
+
AuthorizationResponsePayload,
|
|
12
|
+
AuthorizationRequestPayload,
|
|
13
|
+
URI,
|
|
14
|
+
AuthorizationRequestState,
|
|
15
|
+
RequestObjectPayload,
|
|
16
|
+
AuthorizationRequest,
|
|
17
|
+
AuthorizationResponse,
|
|
18
|
+
RP,
|
|
19
|
+
OP,
|
|
20
|
+
OPBuilder,
|
|
21
|
+
SupportedVersion,
|
|
22
|
+
PresentationDefinitionWithLocation,
|
|
23
|
+
PresentationVerificationResult,
|
|
24
|
+
PresentationVerificationCallback,
|
|
25
|
+
VPTokenLocation,
|
|
26
|
+
} from '@sphereon/did-auth-siop'
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function uriWithBase(path: string, opts?: { baseURI?: string; envVarName?: string }) {
|
|
2
|
+
let baseUri = `${!!opts?.baseURI ? opts.baseURI : opts?.envVarName && process ? process.env[opts.envVarName!] : process?.env?.BACKEND_BASE_URI}`
|
|
3
|
+
if (!baseUri || baseUri === 'undefined') {
|
|
4
|
+
throw Error('No base URI provided as param or environment variable')
|
|
5
|
+
} else if (!baseUri.startsWith('http')) {
|
|
6
|
+
throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`)
|
|
7
|
+
}
|
|
8
|
+
baseUri = baseUri.endsWith('/') ? baseUri.substring(0, baseUri.length - 1) : baseUri
|
|
9
|
+
return `${baseUri}${path.startsWith('/') ? path : '/' + path}`
|
|
10
|
+
}
|
package/dist/auth-model.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AuthorizationResponsePayload } from '@sphereon/did-auth-siop';
|
|
2
|
-
import { AdditionalClaims } from '@sphereon/ssi-types';
|
|
3
|
-
export interface ClaimPayloadCommonOpts {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
}
|
|
6
|
-
export interface AuthorizationChallengeValidationResponse {
|
|
7
|
-
presentation_during_issuance_session: string;
|
|
8
|
-
}
|
|
9
|
-
export type AuthorizationRequestStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
10
|
-
export type AuthorizationResponseStateStatus = 'created' | 'sent' | 'received' | 'verified' | 'error';
|
|
11
|
-
export interface GenerateAuthRequestURIResponse {
|
|
12
|
-
correlationId: string;
|
|
13
|
-
state: string;
|
|
14
|
-
definitionId: string;
|
|
15
|
-
authRequestURI: string;
|
|
16
|
-
authStatusURI: string;
|
|
17
|
-
}
|
|
18
|
-
export interface AuthStatusResponse {
|
|
19
|
-
status: AuthorizationRequestStateStatus | AuthorizationResponseStateStatus;
|
|
20
|
-
correlationId: string;
|
|
21
|
-
error?: string;
|
|
22
|
-
definitionId: string;
|
|
23
|
-
lastUpdated: number;
|
|
24
|
-
payload?: AuthorizationResponsePayload;
|
|
25
|
-
verifiedData?: AdditionalClaims;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=auth-model.d.ts.map
|
package/dist/auth-model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-model.d.ts","sourceRoot":"","sources":["../src/auth-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,WAAW,sBAAsB;IACrC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACjB;AAED,MAAM,WAAW,wCAAwC;IACvD,oCAAoC,EAAE,MAAM,CAAA;CAC7C;AAED,MAAM,MAAM,+BAA+B,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;AAEpG,MAAM,MAAM,gCAAgC,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAA;AAErG,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,+BAA+B,GAAG,gCAAgC,CAAA;IAC1E,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,4BAA4B,CAAA;IACtC,YAAY,CAAC,EAAE,gBAAgB,CAAA;CAChC"}
|
package/dist/auth-model.js
DELETED
package/dist/auth-model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-model.js","sourceRoot":"","sources":["../src/auth-model.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AAGvB;;GAEG;AACH,OAAO,EACL,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,EAC3B,GAAG,EACH,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,EAAE,EACF,EAAE,EACF,SAAS,EACT,gBAAgB,EAChB,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EAChC,eAAe,GAChB,MAAM,yBAAyB,CAAA"}
|
package/dist/utils.d.ts
DELETED
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,UASzF"}
|
package/dist/utils.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uriWithBase = uriWithBase;
|
|
4
|
-
function uriWithBase(path, opts) {
|
|
5
|
-
var _a;
|
|
6
|
-
let baseUri = `${!!(opts === null || opts === void 0 ? void 0 : opts.baseURI) ? opts.baseURI : (opts === null || opts === void 0 ? void 0 : opts.envVarName) && process ? process.env[opts.envVarName] : (_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.BACKEND_BASE_URI}`;
|
|
7
|
-
if (!baseUri || baseUri === 'undefined') {
|
|
8
|
-
throw Error('No base URI provided as param or environment variable');
|
|
9
|
-
}
|
|
10
|
-
else if (!baseUri.startsWith('http')) {
|
|
11
|
-
throw Error(`Base URI needs to start with http(s). Received: ${baseUri}`);
|
|
12
|
-
}
|
|
13
|
-
baseUri = baseUri.endsWith('/') ? baseUri.substring(0, baseUri.length - 1) : baseUri;
|
|
14
|
-
return `${baseUri}${path.startsWith('/') ? path : '/' + path}`;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAAA,kCASC;AATD,SAAgB,WAAW,CAAC,IAAY,EAAE,IAAgD;;IACxF,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAA,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,KAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,0CAAE,gBAAgB,EAAE,CAAA;IAChJ,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QACxC,MAAM,KAAK,CAAC,uDAAuD,CAAC,CAAA;IACtE,CAAC;SAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,CAAC,mDAAmD,OAAO,EAAE,CAAC,CAAA;IAC3E,CAAC;IACD,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACpF,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,CAAA;AAChE,CAAC"}
|