@yourself_id/siwys-react-js 0.35.1-release-2026-11-17.95.0 → 0.36.0
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.d.mts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +65 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -68,13 +68,41 @@ type SignInProps = (SignInPropsBase & {
|
|
|
68
68
|
declare const SignInWithYourSelf: React.FC<SignInProps>;
|
|
69
69
|
|
|
70
70
|
interface QRCodeProps {
|
|
71
|
-
challengeUrl
|
|
71
|
+
/** Any URL/string to encode. Takes precedence over `challengeUrl`. */
|
|
72
|
+
value?: string;
|
|
73
|
+
/** @deprecated Use `value` instead. Kept for backward compatibility. */
|
|
74
|
+
challengeUrl?: string;
|
|
72
75
|
size: number;
|
|
73
76
|
level?: "L" | "M" | "Q" | "H";
|
|
74
77
|
className?: string;
|
|
75
78
|
}
|
|
76
79
|
declare const QRCode: React.FC<QRCodeProps>;
|
|
77
80
|
|
|
81
|
+
interface AttestToQRCodeProps {
|
|
82
|
+
templateDID: string;
|
|
83
|
+
recipientDID: string;
|
|
84
|
+
baseUrl?: string;
|
|
85
|
+
size?: number;
|
|
86
|
+
level?: "L" | "M" | "Q" | "H";
|
|
87
|
+
className?: string;
|
|
88
|
+
}
|
|
89
|
+
declare const AttestToQRCode: React.FC<AttestToQRCodeProps>;
|
|
90
|
+
|
|
91
|
+
declare const DEFAULT_ATTEST_TO_BASE_URL = "https://www.selfid.link";
|
|
92
|
+
interface AttestToUrlOptions {
|
|
93
|
+
templateDID: string;
|
|
94
|
+
recipientDID: string;
|
|
95
|
+
baseUrl?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds a Scan-to-Attest universal link handled by the SELF mobile app
|
|
99
|
+
* (`/attestTo?template=<templateDID>&to=<recipientDID>`).
|
|
100
|
+
*
|
|
101
|
+
* @throws Error when either DID is missing or does not start with `did:`,
|
|
102
|
+
* because the mobile route matcher rejects such links.
|
|
103
|
+
*/
|
|
104
|
+
declare function createAttestToUrl(options: AttestToUrlOptions): string;
|
|
105
|
+
|
|
78
106
|
interface ConnectYourSelfProps {
|
|
79
107
|
challengeDID: string;
|
|
80
108
|
challengeBaseUrl?: string;
|
|
@@ -87,4 +115,4 @@ interface ConnectYourSelfProps {
|
|
|
87
115
|
}
|
|
88
116
|
declare const ConnectYourSelf: React.FC<ConnectYourSelfProps>;
|
|
89
117
|
|
|
90
|
-
export { ConnectYourSelf, CysButton, EXTENSION_ERROR_CODE, type ExtensionBridgeConfig, type ExtensionErrorCode, type ExtensionPartner, type ExtensionSignInResult, type ExtensionSignInStatus, QRCode, type RequestedCredential, type SignInSession, SignInWithYourSelf, SiwysButton };
|
|
118
|
+
export { AttestToQRCode, type AttestToQRCodeProps, type AttestToUrlOptions, ConnectYourSelf, CysButton, DEFAULT_ATTEST_TO_BASE_URL, EXTENSION_ERROR_CODE, type ExtensionBridgeConfig, type ExtensionErrorCode, type ExtensionPartner, type ExtensionSignInResult, type ExtensionSignInStatus, QRCode, type QRCodeProps, type RequestedCredential, type SignInSession, SignInWithYourSelf, SiwysButton, createAttestToUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -68,13 +68,41 @@ type SignInProps = (SignInPropsBase & {
|
|
|
68
68
|
declare const SignInWithYourSelf: React.FC<SignInProps>;
|
|
69
69
|
|
|
70
70
|
interface QRCodeProps {
|
|
71
|
-
challengeUrl
|
|
71
|
+
/** Any URL/string to encode. Takes precedence over `challengeUrl`. */
|
|
72
|
+
value?: string;
|
|
73
|
+
/** @deprecated Use `value` instead. Kept for backward compatibility. */
|
|
74
|
+
challengeUrl?: string;
|
|
72
75
|
size: number;
|
|
73
76
|
level?: "L" | "M" | "Q" | "H";
|
|
74
77
|
className?: string;
|
|
75
78
|
}
|
|
76
79
|
declare const QRCode: React.FC<QRCodeProps>;
|
|
77
80
|
|
|
81
|
+
interface AttestToQRCodeProps {
|
|
82
|
+
templateDID: string;
|
|
83
|
+
recipientDID: string;
|
|
84
|
+
baseUrl?: string;
|
|
85
|
+
size?: number;
|
|
86
|
+
level?: "L" | "M" | "Q" | "H";
|
|
87
|
+
className?: string;
|
|
88
|
+
}
|
|
89
|
+
declare const AttestToQRCode: React.FC<AttestToQRCodeProps>;
|
|
90
|
+
|
|
91
|
+
declare const DEFAULT_ATTEST_TO_BASE_URL = "https://www.selfid.link";
|
|
92
|
+
interface AttestToUrlOptions {
|
|
93
|
+
templateDID: string;
|
|
94
|
+
recipientDID: string;
|
|
95
|
+
baseUrl?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds a Scan-to-Attest universal link handled by the SELF mobile app
|
|
99
|
+
* (`/attestTo?template=<templateDID>&to=<recipientDID>`).
|
|
100
|
+
*
|
|
101
|
+
* @throws Error when either DID is missing or does not start with `did:`,
|
|
102
|
+
* because the mobile route matcher rejects such links.
|
|
103
|
+
*/
|
|
104
|
+
declare function createAttestToUrl(options: AttestToUrlOptions): string;
|
|
105
|
+
|
|
78
106
|
interface ConnectYourSelfProps {
|
|
79
107
|
challengeDID: string;
|
|
80
108
|
challengeBaseUrl?: string;
|
|
@@ -87,4 +115,4 @@ interface ConnectYourSelfProps {
|
|
|
87
115
|
}
|
|
88
116
|
declare const ConnectYourSelf: React.FC<ConnectYourSelfProps>;
|
|
89
117
|
|
|
90
|
-
export { ConnectYourSelf, CysButton, EXTENSION_ERROR_CODE, type ExtensionBridgeConfig, type ExtensionErrorCode, type ExtensionPartner, type ExtensionSignInResult, type ExtensionSignInStatus, QRCode, type RequestedCredential, type SignInSession, SignInWithYourSelf, SiwysButton };
|
|
118
|
+
export { AttestToQRCode, type AttestToQRCodeProps, type AttestToUrlOptions, ConnectYourSelf, CysButton, DEFAULT_ATTEST_TO_BASE_URL, EXTENSION_ERROR_CODE, type ExtensionBridgeConfig, type ExtensionErrorCode, type ExtensionPartner, type ExtensionSignInResult, type ExtensionSignInStatus, QRCode, type QRCodeProps, type RequestedCredential, type SignInSession, SignInWithYourSelf, SiwysButton, createAttestToUrl };
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,14 @@ function _define_property(obj, key, value) {
|
|
|
49
49
|
}
|
|
50
50
|
return obj;
|
|
51
51
|
}
|
|
52
|
+
function _instanceof(left, right) {
|
|
53
|
+
"@swc/helpers - instanceof";
|
|
54
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
55
|
+
return !!right[Symbol.hasInstance](left);
|
|
56
|
+
} else {
|
|
57
|
+
return left instanceof right;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
52
60
|
function _iterable_to_array_limit(arr, i) {
|
|
53
61
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
54
62
|
if (_i == null) return;
|
|
@@ -576,12 +584,18 @@ var __toCommonJS = function __toCommonJS(mod) {
|
|
|
576
584
|
// src/index.ts
|
|
577
585
|
var index_exports = {};
|
|
578
586
|
__export(index_exports, {
|
|
587
|
+
AttestToQRCode: function AttestToQRCode() {
|
|
588
|
+
return AttestToQRCode_default;
|
|
589
|
+
},
|
|
579
590
|
ConnectYourSelf: function ConnectYourSelf() {
|
|
580
591
|
return ConnectYourSelf_default;
|
|
581
592
|
},
|
|
582
593
|
CysButton: function CysButton1() {
|
|
583
594
|
return CysButton;
|
|
584
595
|
},
|
|
596
|
+
DEFAULT_ATTEST_TO_BASE_URL: function DEFAULT_ATTEST_TO_BASE_URL1() {
|
|
597
|
+
return DEFAULT_ATTEST_TO_BASE_URL;
|
|
598
|
+
},
|
|
585
599
|
EXTENSION_ERROR_CODE: function EXTENSION_ERROR_CODE1() {
|
|
586
600
|
return EXTENSION_ERROR_CODE;
|
|
587
601
|
},
|
|
@@ -593,6 +607,9 @@ __export(index_exports, {
|
|
|
593
607
|
},
|
|
594
608
|
SiwysButton: function SiwysButton1() {
|
|
595
609
|
return SiwysButton;
|
|
610
|
+
},
|
|
611
|
+
createAttestToUrl: function createAttestToUrl1() {
|
|
612
|
+
return createAttestToUrl;
|
|
596
613
|
}
|
|
597
614
|
});
|
|
598
615
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1049,9 +1066,10 @@ var import_react3 = __toESM(require("react"));
|
|
|
1049
1066
|
var import_qrcode = require("qrcode.react");
|
|
1050
1067
|
var SelfSvg = '\n<svg width="104" height="32" viewBox="0 0 104 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect width="104" height="31.5" fill="white"/>\n<path d="M28.1416 25.0276H16.8487C16.4035 25.0276 16.0414 24.6699 16.0414 24.228V21.4124C16.0414 20.9714 16.4026 20.6127 16.8487 20.6127H28.0064C29.1408 20.6127 29.7893 19.9976 29.7893 19.2213C29.7893 18.4451 29.1408 17.8037 28.0064 17.8037H21.3891C17.2836 17.8037 14.9609 15.3159 14.9609 12.1052C14.9609 8.89444 17.6891 6.30078 21.3891 6.30078H33.1414C33.5867 6.30078 33.9487 6.65846 33.9487 7.10042V9.91599C33.9487 10.357 33.5876 10.7156 33.1414 10.7156H21.6056C20.3096 10.7156 19.7689 11.4647 19.7689 12.107C19.7689 12.7494 20.3899 13.4179 21.6056 13.4179H27.9799C31.8151 13.4179 34.5972 15.6923 34.5972 19.2232C34.5972 22.4068 32.1394 25.0285 28.1416 25.0285V25.0276Z" fill="black"/>\n<path d="M73.7575 6.30078H89.7533C90.1985 6.30078 90.5606 6.65846 90.5606 7.10042V9.91599C90.5606 10.357 90.1995 10.7156 89.7533 10.7156H78.6732C78.2279 10.7156 77.8658 11.0733 77.8658 11.5153V12.6726C77.8658 13.1136 78.227 13.4722 78.6732 13.4722H89.4026C89.8478 13.4722 90.2099 13.8299 90.2099 14.2718V17.0603C90.2099 17.5013 89.8488 17.8599 89.4026 17.8599H78.6732C78.2279 17.8599 77.8658 18.2176 77.8658 18.6595V24.2308C77.8658 24.6718 77.5047 25.0304 77.0585 25.0304H73.7565C73.3113 25.0304 72.9492 24.6727 72.9492 24.2308V7.10042C72.9492 6.6594 73.3103 6.30078 73.7565 6.30078H73.7575Z" fill="black"/>\n<path d="M54.9587 6.30078H58.2607C58.706 6.30078 59.068 6.65846 59.068 7.10042V19.814C59.068 20.2551 59.4291 20.6137 59.8753 20.6137H70.7399C71.1852 20.6137 71.5472 20.9714 71.5472 21.4133V24.2289C71.5472 24.6699 71.1861 25.0285 70.7399 25.0285H54.9597C54.5144 25.0285 54.1523 24.6708 54.1523 24.2289V7.10042C54.1514 6.65846 54.5125 6.30078 54.9587 6.30078Z" fill="black"/>\n<path d="M36.5104 6.30078H51.9391C52.3843 6.30078 52.7464 6.65846 52.7464 7.10042V9.91599C52.7464 10.357 52.3853 10.7156 51.9391 10.7156H41.3722C40.927 10.7156 40.5649 11.0733 40.5649 11.5153V12.6726C40.5649 13.1136 40.926 13.4722 41.3722 13.4722H50.9673C51.4125 13.4722 51.7746 13.8299 51.7746 14.2718V17.0603C51.7746 17.5013 51.4135 17.8599 50.9673 17.8599H41.3722C40.927 17.8599 40.5649 18.2176 40.5649 18.6595V19.8169C40.5649 20.2579 40.926 20.6165 41.3722 20.6165H51.8313C52.2765 20.6165 52.6386 20.9742 52.6386 21.4161V24.2317C52.6386 24.6727 52.2775 25.0313 51.8313 25.0313H36.5104C36.0652 25.0313 35.7031 24.6737 35.7031 24.2317V7.10042C35.7031 6.65846 36.0642 6.30078 36.5104 6.30078Z" fill="black"/>\n<path d="M94.8749 10.6208C93.6613 10.6208 92.7227 9.6821 92.7227 8.45819C92.7227 7.23946 93.6613 6.30078 94.8749 6.30078C96.104 6.30078 97.0427 7.23946 97.0427 8.45819C97.0427 9.6821 96.104 10.6208 94.8749 10.6208ZM94.8749 10.3044C95.9225 10.3044 96.7263 9.50059 96.7263 8.45819C96.7263 7.40542 95.9225 6.60157 94.8749 6.60157C93.8273 6.60157 93.0234 7.4106 93.0234 8.45819C93.0234 9.50059 93.8273 10.3044 94.8749 10.3044ZM94.097 9.63543C94.0658 9.63543 94.0451 9.61468 94.0451 9.58357V7.34318C94.0451 7.31207 94.0658 7.29132 94.097 7.29132H95.1238C95.518 7.29132 95.8136 7.59211 95.8136 7.99663C95.8136 8.25593 95.6891 8.45819 95.4868 8.57747C95.4609 8.59821 95.4557 8.61896 95.4661 8.65007L95.855 9.57319C95.8706 9.6095 95.8499 9.63543 95.8136 9.63543H95.4142C95.3883 9.63543 95.3676 9.62506 95.3572 9.59394L95.0097 8.71231C94.9993 8.68119 94.9786 8.67082 94.9527 8.67082H94.5637C94.5326 8.67082 94.5119 8.69156 94.5119 8.72268V9.58357C94.5119 9.61468 94.4911 9.63543 94.46 9.63543H94.097ZM95.0201 8.27668C95.2327 8.27668 95.3468 8.1574 95.3468 7.99663C95.3468 7.81512 95.2275 7.70102 95.0201 7.70102H94.5637C94.5326 7.70102 94.5119 7.72177 94.5119 7.75288V8.22481C94.5119 8.25593 94.5326 8.27668 94.5637 8.27668H95.0201Z" fill="black"/>\n</svg>\n\n';
|
|
1051
1068
|
var QRCode = function QRCode(props) {
|
|
1069
|
+
var _ref, _props_value;
|
|
1052
1070
|
return /* @__PURE__ */ import_react3.default.createElement(import_qrcode.QRCodeSVG, {
|
|
1053
1071
|
"data-testid": "qr-code",
|
|
1054
|
-
value: props.challengeUrl,
|
|
1072
|
+
value: (_ref = (_props_value = props.value) !== null && _props_value !== void 0 ? _props_value : props.challengeUrl) !== null && _ref !== void 0 ? _ref : "",
|
|
1055
1073
|
size: props.size,
|
|
1056
1074
|
level: props.level || "M",
|
|
1057
1075
|
marginSize: 2,
|
|
@@ -1958,11 +1976,51 @@ var SignInWithYourSelf = function SignInWithYourSelf(param) {
|
|
|
1958
1976
|
}))))));
|
|
1959
1977
|
};
|
|
1960
1978
|
var SignInWithYourSelf_default = SignInWithYourSelf;
|
|
1961
|
-
// src/components/
|
|
1979
|
+
// src/components/attest/AttestToQRCode.tsx
|
|
1962
1980
|
var import_react5 = __toESM(require("react"));
|
|
1981
|
+
// src/utils/attestToUrl.ts
|
|
1982
|
+
var DEFAULT_ATTEST_TO_BASE_URL = "https://www.selfid.link";
|
|
1983
|
+
var DID_PREFIX = "did:";
|
|
1984
|
+
function isDid2(value) {
|
|
1985
|
+
return typeof value === "string" && value.startsWith(DID_PREFIX);
|
|
1986
|
+
}
|
|
1987
|
+
function createAttestToUrl(options) {
|
|
1988
|
+
var templateDID = options.templateDID, recipientDID = options.recipientDID, baseUrl = options.baseUrl;
|
|
1989
|
+
if (!isDid2(templateDID) || !isDid2(recipientDID)) {
|
|
1990
|
+
throw new Error("Both templateDID and recipientDID are required and must start with 'did:'");
|
|
1991
|
+
}
|
|
1992
|
+
var origin = (baseUrl || DEFAULT_ATTEST_TO_BASE_URL).replace(/\/+$/, "");
|
|
1993
|
+
return "".concat(origin, "/attestTo?template=").concat(encodeURIComponent(templateDID), "&to=").concat(encodeURIComponent(recipientDID));
|
|
1994
|
+
}
|
|
1995
|
+
// src/components/attest/AttestToQRCode.tsx
|
|
1996
|
+
var DEFAULT_SIZE = 212;
|
|
1997
|
+
var AttestToQRCode = function AttestToQRCode(param) {
|
|
1998
|
+
var templateDID = param.templateDID, recipientDID = param.recipientDID, baseUrl = param.baseUrl, _param_size = param.size, size = _param_size === void 0 ? DEFAULT_SIZE : _param_size, _param_level = param.level, level = _param_level === void 0 ? "M" : _param_level, className = param.className;
|
|
1999
|
+
var url;
|
|
2000
|
+
try {
|
|
2001
|
+
url = createAttestToUrl({
|
|
2002
|
+
templateDID: templateDID,
|
|
2003
|
+
recipientDID: recipientDID,
|
|
2004
|
+
baseUrl: baseUrl
|
|
2005
|
+
});
|
|
2006
|
+
} catch (error) {
|
|
2007
|
+
var message = _instanceof(error, Error) ? error.message : String(error);
|
|
2008
|
+
console.warn("[AttestToQRCode] Not rendering QR code: ".concat(message));
|
|
2009
|
+
return null;
|
|
2010
|
+
}
|
|
2011
|
+
return /* @__PURE__ */ import_react5.default.createElement(QrCode_default, {
|
|
2012
|
+
value: url,
|
|
2013
|
+
size: size,
|
|
2014
|
+
level: level,
|
|
2015
|
+
className: className
|
|
2016
|
+
});
|
|
2017
|
+
};
|
|
2018
|
+
var AttestToQRCode_default = AttestToQRCode;
|
|
2019
|
+
// src/components/connect/ConnectYourSelf.tsx
|
|
2020
|
+
var import_react6 = __toESM(require("react"));
|
|
1963
2021
|
var ConnectYourSelf = function ConnectYourSelf(param) {
|
|
1964
2022
|
var challengeBaseUrl = param.challengeBaseUrl, challengeDID = param.challengeDID, onConnectPress = param.onConnectPress, extensionConfig = param.extensionConfig, partner = param.partner, requestedCredentials = param.requestedCredentials, onAuthenticated = param.onAuthenticated, onExtensionResult = param.onExtensionResult;
|
|
1965
|
-
return /* @__PURE__ */
|
|
2023
|
+
return /* @__PURE__ */ import_react6.default.createElement(SignInWithYourSelf_default, {
|
|
1966
2024
|
challengeBaseUrl: challengeBaseUrl,
|
|
1967
2025
|
challengeDID: challengeDID,
|
|
1968
2026
|
onSiwysPress: onConnectPress,
|
|
@@ -1977,11 +2035,14 @@ var ConnectYourSelf = function ConnectYourSelf(param) {
|
|
|
1977
2035
|
var ConnectYourSelf_default = ConnectYourSelf;
|
|
1978
2036
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1979
2037
|
0 && (module.exports = {
|
|
2038
|
+
AttestToQRCode: AttestToQRCode,
|
|
1980
2039
|
ConnectYourSelf: ConnectYourSelf,
|
|
1981
2040
|
CysButton: CysButton,
|
|
2041
|
+
DEFAULT_ATTEST_TO_BASE_URL: DEFAULT_ATTEST_TO_BASE_URL,
|
|
1982
2042
|
EXTENSION_ERROR_CODE: EXTENSION_ERROR_CODE,
|
|
1983
2043
|
QRCode: QRCode,
|
|
1984
2044
|
SignInWithYourSelf: SignInWithYourSelf,
|
|
1985
|
-
SiwysButton: SiwysButton
|
|
2045
|
+
SiwysButton: SiwysButton,
|
|
2046
|
+
createAttestToUrl: createAttestToUrl
|
|
1986
2047
|
});
|
|
1987
2048
|
//# sourceMappingURL=index.js.map
|