@bsv/sdk 1.3.36 → 1.4.1
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/cjs/mod.js +3 -0
- package/dist/cjs/mod.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/auth/Peer.js +42 -14
- package/dist/cjs/src/auth/Peer.js.map +1 -1
- package/dist/cjs/src/auth/certificates/Certificate.js +50 -22
- package/dist/cjs/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/MasterCertificate.js +35 -10
- package/dist/cjs/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js +28 -4
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js +5 -2
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/cjs/src/auth/clients/AuthFetch.js +50 -20
- package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/cjs/src/auth/transports/SimplifiedFetchTransport.js +40 -17
- package/dist/cjs/src/auth/transports/SimplifiedFetchTransport.js.map +1 -1
- package/dist/cjs/src/auth/utils/createNonce.js +31 -4
- package/dist/cjs/src/auth/utils/createNonce.js.map +1 -1
- package/dist/cjs/src/auth/utils/verifyNonce.js +26 -3
- package/dist/cjs/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/cjs/src/identity/IdentityClient.js +258 -0
- package/dist/cjs/src/identity/IdentityClient.js.map +1 -0
- package/dist/cjs/src/identity/index.js +19 -0
- package/dist/cjs/src/identity/index.js.map +1 -0
- package/dist/cjs/src/identity/types/index.js +30 -0
- package/dist/cjs/src/identity/types/index.js.map +1 -0
- package/dist/cjs/src/overlay-tools/LookupResolver.js +2 -2
- package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/cjs/src/primitives/utils.js.map +1 -1
- package/dist/cjs/src/registry/RegistryClient.js +392 -0
- package/dist/cjs/src/registry/RegistryClient.js.map +1 -0
- package/dist/cjs/src/registry/index.js +19 -0
- package/dist/cjs/src/registry/index.js.map +1 -0
- package/dist/cjs/src/registry/types/index.js +3 -0
- package/dist/cjs/src/registry/types/index.js.map +1 -0
- package/dist/cjs/src/storage/StorageUploader.js +93 -0
- package/dist/cjs/src/storage/StorageUploader.js.map +1 -0
- package/dist/cjs/src/storage/StorageUtils.js +73 -0
- package/dist/cjs/src/storage/StorageUtils.js.map +1 -0
- package/dist/cjs/src/storage/__test/StorageUploader.test.js +92 -0
- package/dist/cjs/src/storage/__test/StorageUploader.test.js.map +1 -0
- package/dist/cjs/src/storage/__test/StorageUtils.test.js +97 -0
- package/dist/cjs/src/storage/__test/StorageUtils.test.js.map +1 -0
- package/dist/cjs/src/storage/index.js +30 -0
- package/dist/cjs/src/storage/index.js.map +1 -0
- package/dist/cjs/src/wallet/WalletClient.js +4 -4
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/HTTPWalletWire.js +26 -3
- package/dist/cjs/src/wallet/substrates/HTTPWalletWire.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js +178 -155
- package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js +171 -148
- package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/XDM.js +29 -2
- package/dist/cjs/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/mod.js +3 -0
- package/dist/esm/mod.js.map +1 -1
- package/dist/esm/src/auth/Peer.js +7 -5
- package/dist/esm/src/auth/Peer.js.map +1 -1
- package/dist/esm/src/auth/certificates/Certificate.js +3 -1
- package/dist/esm/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/MasterCertificate.js +3 -1
- package/dist/esm/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js +2 -1
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +1 -1
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/esm/src/auth/clients/AuthFetch.js +5 -1
- package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/esm/src/auth/transports/SimplifiedFetchTransport.js +1 -1
- package/dist/esm/src/auth/transports/SimplifiedFetchTransport.js.map +1 -1
- package/dist/esm/src/auth/utils/createNonce.js +2 -1
- package/dist/esm/src/auth/utils/createNonce.js.map +1 -1
- package/dist/esm/src/auth/utils/verifyNonce.js +1 -1
- package/dist/esm/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/esm/src/identity/IdentityClient.js +255 -0
- package/dist/esm/src/identity/IdentityClient.js.map +1 -0
- package/dist/esm/src/identity/index.js +3 -0
- package/dist/esm/src/identity/index.js.map +1 -0
- package/dist/esm/src/identity/types/index.js +27 -0
- package/dist/esm/src/identity/types/index.js.map +1 -0
- package/dist/esm/src/overlay-tools/LookupResolver.js +2 -2
- package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/esm/src/primitives/utils.js.map +1 -1
- package/dist/esm/src/registry/RegistryClient.js +388 -0
- package/dist/esm/src/registry/RegistryClient.js.map +1 -0
- package/dist/esm/src/registry/index.js +3 -0
- package/dist/esm/src/registry/index.js.map +1 -0
- package/dist/esm/src/registry/types/index.js +2 -0
- package/dist/esm/src/registry/types/index.js.map +1 -0
- package/dist/esm/src/storage/StorageUploader.js +68 -0
- package/dist/esm/src/storage/StorageUploader.js.map +1 -0
- package/dist/esm/src/storage/StorageUtils.js +65 -0
- package/dist/esm/src/storage/StorageUtils.js.map +1 -0
- package/dist/esm/src/storage/__test/StorageUploader.test.js +64 -0
- package/dist/esm/src/storage/__test/StorageUploader.test.js.map +1 -0
- package/dist/esm/src/storage/__test/StorageUtils.test.js +72 -0
- package/dist/esm/src/storage/__test/StorageUtils.test.js.map +1 -0
- package/dist/esm/src/storage/index.js +3 -0
- package/dist/esm/src/storage/index.js.map +1 -0
- package/dist/esm/src/wallet/WalletClient.js +4 -4
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletWire.js +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletWire.js.map +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireProcessor.js +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js +2 -2
- package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
- package/dist/esm/src/wallet/substrates/XDM.js +2 -1
- package/dist/esm/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/mod.d.ts +3 -0
- package/dist/types/mod.d.ts.map +1 -1
- package/dist/types/src/auth/Peer.d.ts +1 -1
- package/dist/types/src/auth/Peer.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/Certificate.d.ts +2 -1
- package/dist/types/src/auth/certificates/Certificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts +2 -1
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts +2 -1
- package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts +1 -1
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -1
- package/dist/types/src/auth/clients/AuthFetch.d.ts +1 -1
- package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
- package/dist/types/src/auth/utils/createNonce.d.ts +1 -1
- package/dist/types/src/auth/utils/createNonce.d.ts.map +1 -1
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts +1 -1
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts.map +1 -1
- package/dist/types/src/auth/utils/verifyNonce.d.ts +1 -1
- package/dist/types/src/auth/utils/verifyNonce.d.ts.map +1 -1
- package/dist/types/src/identity/IdentityClient.d.ts +50 -0
- package/dist/types/src/identity/IdentityClient.d.ts.map +1 -0
- package/dist/types/src/identity/index.d.ts +3 -0
- package/dist/types/src/identity/index.d.ts.map +1 -0
- package/dist/types/src/identity/types/index.d.ts +30 -0
- package/dist/types/src/identity/types/index.d.ts.map +1 -0
- package/dist/types/src/primitives/utils.d.ts +4 -1
- package/dist/types/src/primitives/utils.d.ts.map +1 -1
- package/dist/types/src/registry/RegistryClient.d.ts +94 -0
- package/dist/types/src/registry/RegistryClient.d.ts.map +1 -0
- package/dist/types/src/registry/index.d.ts +3 -0
- package/dist/types/src/registry/index.d.ts.map +1 -0
- package/dist/types/src/registry/types/index.d.ts +86 -0
- package/dist/types/src/registry/types/index.d.ts.map +1 -0
- package/dist/types/src/storage/StorageUploader.d.ts +40 -0
- package/dist/types/src/storage/StorageUploader.d.ts.map +1 -0
- package/dist/types/src/storage/StorageUtils.d.ts +31 -0
- package/dist/types/src/storage/StorageUtils.d.ts.map +1 -0
- package/dist/types/src/storage/__test/StorageUploader.test.d.ts +2 -0
- package/dist/types/src/storage/__test/StorageUploader.test.d.ts.map +1 -0
- package/dist/types/src/storage/__test/StorageUtils.test.d.ts +2 -0
- package/dist/types/src/storage/__test/StorageUtils.test.d.ts.map +1 -0
- package/dist/types/src/storage/index.d.ts +3 -0
- package/dist/types/src/storage/index.d.ts.map +1 -0
- package/dist/types/src/wallet/substrates/XDM.d.ts +1 -1
- package/dist/types/src/wallet/substrates/XDM.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/primitives.md +4 -1
- package/docs/storage.md +210 -0
- package/docs/wallet-substrates.md +0 -225
- package/mod.ts +3 -0
- package/package.json +11 -1
- package/src/auth/Peer.ts +8 -5
- package/src/auth/__tests/Peer.test.ts +31 -31
- package/src/auth/certificates/Certificate.ts +5 -5
- package/src/auth/certificates/MasterCertificate.ts +5 -5
- package/src/auth/certificates/VerifiableCertificate.ts +6 -6
- package/src/auth/certificates/__tests/CompletedProtoWallet.ts +1 -15
- package/src/auth/clients/AuthFetch.ts +6 -1
- package/src/auth/transports/SimplifiedFetchTransport.ts +1 -1
- package/src/auth/utils/createNonce.ts +3 -3
- package/src/auth/utils/getVerifiableCertificates.ts +1 -1
- package/src/auth/utils/verifyNonce.ts +2 -1
- package/src/identity/IdentityClient.ts +305 -0
- package/src/identity/README.md +93 -0
- package/src/identity/__tests/IdentityClient.test.ts +278 -0
- package/src/identity/index.ts +2 -0
- package/src/identity/types/index.ts +46 -0
- package/src/overlay-tools/LookupResolver.ts +2 -2
- package/src/primitives/utils.ts +1 -1
- package/src/registry/RegistryClient.ts +493 -0
- package/src/registry/__tests/RegistryClient.test.ts +444 -0
- package/src/registry/index.ts +2 -0
- package/src/registry/types/index.ts +101 -0
- package/src/storage/StorageUploader.ts +108 -0
- package/src/storage/StorageUtils.ts +66 -0
- package/src/storage/__test/StorageUploader.test.ts +80 -0
- package/src/storage/__test/StorageUtils.test.ts +86 -0
- package/src/storage/index.ts +2 -0
- package/src/wallet/WalletClient.ts +4 -4
- package/src/wallet/substrates/HTTPWalletWire.ts +1 -1
- package/src/wallet/substrates/WalletWireProcessor.ts +1 -1
- package/src/wallet/substrates/WalletWireTransceiver.ts +2 -2
- package/src/wallet/substrates/XDM.ts +3 -2
|
@@ -6,7 +6,7 @@ import { Utils, PrivateKey } from '../../primitives/index.js'
|
|
|
6
6
|
import { VerifiableCertificate } from '../../auth/certificates/VerifiableCertificate.js'
|
|
7
7
|
import { MasterCertificate } from '../../auth/certificates/MasterCertificate.js'
|
|
8
8
|
import { getVerifiableCertificates } from '../../auth/utils/getVerifiableCertificates.js'
|
|
9
|
-
import { CompletedProtoWallet } from '
|
|
9
|
+
import { CompletedProtoWallet } from '../certificates/__tests/CompletedProtoWallet.js'
|
|
10
10
|
|
|
11
11
|
jest.mock('../../auth/utils/getVerifiableCertificates')
|
|
12
12
|
|
|
@@ -337,7 +337,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
337
337
|
}
|
|
338
338
|
resolve()
|
|
339
339
|
})().catch((e) => {
|
|
340
|
-
console.error(e)
|
|
340
|
+
// console.error(e)
|
|
341
341
|
})
|
|
342
342
|
})
|
|
343
343
|
})
|
|
@@ -396,9 +396,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
396
396
|
Object.keys(decryptedFields).length !== 0 &&
|
|
397
397
|
typeof decryptedFields.libraryCardNumber !== 'undefined'
|
|
398
398
|
) {
|
|
399
|
-
console.log(
|
|
400
|
-
|
|
401
|
-
)
|
|
399
|
+
// console.log(
|
|
400
|
+
// `Alice received Bob's library card number: ${decryptedFields.libraryCardNumber}`
|
|
401
|
+
// )
|
|
402
402
|
aliceAcceptedLibraryCard()
|
|
403
403
|
}
|
|
404
404
|
}
|
|
@@ -407,7 +407,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
407
407
|
|
|
408
408
|
const bobReceivedGeneralMessage = new Promise<void>((resolve) => {
|
|
409
409
|
bob.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
410
|
-
console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
410
|
+
// console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
411
411
|
resolve()
|
|
412
412
|
})
|
|
413
413
|
})
|
|
@@ -452,7 +452,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
452
452
|
bob.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
453
453
|
(async () => {
|
|
454
454
|
await bobReceivedCertificates
|
|
455
|
-
console.log('Bob received message:', Utils.toUTF8(payload))
|
|
455
|
+
// console.log('Bob received message:', Utils.toUTF8(payload))
|
|
456
456
|
|
|
457
457
|
// Bob requests additional certificates after initial communication
|
|
458
458
|
await bob.requestCertificates(certificatesToRequest, senderPublicKey)
|
|
@@ -473,11 +473,11 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
473
473
|
// Decrypt to confirm
|
|
474
474
|
for (const cert of certificates) {
|
|
475
475
|
const decrypted = await cert.decryptFields(walletB)
|
|
476
|
-
console.log(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
)
|
|
480
|
-
console.log('Decrypted fields:', decrypted)
|
|
476
|
+
// console.log(
|
|
477
|
+
// 'Bob received additional certificates from Alice:',
|
|
478
|
+
// cert
|
|
479
|
+
// )
|
|
480
|
+
// console.log('Decrypted fields:', decrypted)
|
|
481
481
|
}
|
|
482
482
|
resolve()
|
|
483
483
|
}
|
|
@@ -535,9 +535,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
535
535
|
// Decrypt Alice's certificate fields
|
|
536
536
|
const decryptedFields = await cert.decryptFields(walletB)
|
|
537
537
|
if (typeof decryptedFields.membershipStatus !== 'undefined') {
|
|
538
|
-
console.log(
|
|
539
|
-
|
|
540
|
-
)
|
|
538
|
+
// console.log(
|
|
539
|
+
// `Bob received Alice's membership status: ${decryptedFields.membershipStatus}`
|
|
540
|
+
// )
|
|
541
541
|
bobAcceptedMembershipStatus()
|
|
542
542
|
resolve()
|
|
543
543
|
}
|
|
@@ -551,7 +551,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
551
551
|
|
|
552
552
|
const bobReceivedGeneralMessage = new Promise<void>((resolve) => {
|
|
553
553
|
bob.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
554
|
-
console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
554
|
+
// console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
555
555
|
resolve()
|
|
556
556
|
})
|
|
557
557
|
})
|
|
@@ -628,9 +628,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
628
628
|
for (const cert of certificates) {
|
|
629
629
|
const decryptedFields = await cert.decryptFields(walletA)
|
|
630
630
|
if (decryptedFields.driversLicenseNumber !== undefined) {
|
|
631
|
-
console.log(
|
|
632
|
-
|
|
633
|
-
)
|
|
631
|
+
// console.log(
|
|
632
|
+
// `Alice received Bob's driver's license number: ${decryptedFields.driversLicenseNumber}`
|
|
633
|
+
// )
|
|
634
634
|
aliceAcceptedBobDL()
|
|
635
635
|
resolve()
|
|
636
636
|
}
|
|
@@ -646,9 +646,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
646
646
|
for (const cert of certificates) {
|
|
647
647
|
const decryptedFields = await cert.decryptFields(walletB)
|
|
648
648
|
if (decryptedFields.driversLicenseNumber !== undefined) {
|
|
649
|
-
console.log(
|
|
650
|
-
|
|
651
|
-
)
|
|
649
|
+
// console.log(
|
|
650
|
+
// `Bob received Alice's driver's license number: ${decryptedFields.driversLicenseNumber}`
|
|
651
|
+
// )
|
|
652
652
|
bobAcceptedAliceDL()
|
|
653
653
|
resolve()
|
|
654
654
|
}
|
|
@@ -661,7 +661,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
661
661
|
const bobReceivedGeneralMessage = new Promise<void>((resolve) => {
|
|
662
662
|
bob.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
663
663
|
(async () => {
|
|
664
|
-
console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
664
|
+
// console.log('Bob received message from Alice:', Utils.toUTF8(payload))
|
|
665
665
|
await bob.toPeer(
|
|
666
666
|
Utils.toArray('Looking forward to carpooling!'),
|
|
667
667
|
senderPublicKey
|
|
@@ -673,7 +673,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
673
673
|
|
|
674
674
|
const aliceReceivedGeneralMessage = new Promise<void>((resolve) => {
|
|
675
675
|
alice.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
676
|
-
console.log('Alice received message from Bob:', Utils.toUTF8(payload))
|
|
676
|
+
// console.log('Alice received message from Bob:', Utils.toUTF8(payload))
|
|
677
677
|
resolve()
|
|
678
678
|
})
|
|
679
679
|
})
|
|
@@ -754,9 +754,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
754
754
|
for (const cert of certificates) {
|
|
755
755
|
const decryptedFields = await cert.decryptFields(walletA)
|
|
756
756
|
if (decryptedFields.email !== undefined || decryptedFields.name !== undefined) {
|
|
757
|
-
console.log(
|
|
758
|
-
|
|
759
|
-
)
|
|
757
|
+
// console.log(
|
|
758
|
+
// `Alice received Bob's certificate with fields: ${Object.keys(decryptedFields).join(', ')}`
|
|
759
|
+
// )
|
|
760
760
|
aliceAcceptedPartialCert()
|
|
761
761
|
resolve()
|
|
762
762
|
}
|
|
@@ -771,9 +771,9 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
771
771
|
for (const cert of certificates) {
|
|
772
772
|
const decryptedFields = await cert.decryptFields(walletB)
|
|
773
773
|
if (decryptedFields.email !== undefined || decryptedFields.name !== undefined) {
|
|
774
|
-
console.log(
|
|
775
|
-
|
|
776
|
-
)
|
|
774
|
+
// console.log(
|
|
775
|
+
// `Bob received Alice's certificate with fields: ${Object.keys(decryptedFields).join(', ')}`
|
|
776
|
+
// )
|
|
777
777
|
bobAcceptedPartialCert()
|
|
778
778
|
resolve()
|
|
779
779
|
}
|
|
@@ -784,7 +784,7 @@ describe('Peer class mutual authentication and certificate exchange', () => {
|
|
|
784
784
|
|
|
785
785
|
const bobReceivedGeneralMessage = new Promise<void>((resolve) => {
|
|
786
786
|
bob.listenForGeneralMessages((senderPublicKey, payload) => {
|
|
787
|
-
console.log('Bob received message:', Utils.toUTF8(payload))
|
|
787
|
+
// console.log('Bob received message:', Utils.toUTF8(payload))
|
|
788
788
|
resolve()
|
|
789
789
|
})
|
|
790
790
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Utils,
|
|
3
2
|
Base64String,
|
|
4
3
|
PubKeyHex,
|
|
5
4
|
HexString,
|
|
6
5
|
OutpointString,
|
|
7
6
|
CertificateFieldNameUnder50Bytes,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
WalletProtocol
|
|
8
|
+
} from '../../wallet/Wallet.interfaces.js'
|
|
9
|
+
import * as Utils from '../../primitives/utils.js'
|
|
10
|
+
import ProtoWallet from '../../wallet/ProtoWallet.js'
|
|
11
|
+
import Signature from '../../primitives/Signature.js'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Represents an Identity Certificate as per the Wallet interface specifications.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
SymmetricKey,
|
|
3
|
-
Utils,
|
|
4
2
|
Base64String,
|
|
5
3
|
CertificateFieldNameUnder50Bytes,
|
|
6
4
|
HexString,
|
|
7
5
|
OutpointString,
|
|
8
6
|
PubKeyHex,
|
|
9
|
-
Random,
|
|
10
7
|
WalletCounterparty,
|
|
11
|
-
|
|
12
|
-
} from '../../../mod.js'
|
|
8
|
+
} from '../../wallet/Wallet.interfaces.js'
|
|
13
9
|
import Certificate from './Certificate.js'
|
|
10
|
+
import * as Utils from '../../primitives/utils.js'
|
|
11
|
+
import SymmetricKey from '../../primitives/SymmetricKey.js'
|
|
12
|
+
import Random from '../../primitives/Random.js'
|
|
13
|
+
import ProtoWallet from '../../wallet/ProtoWallet.js'
|
|
14
14
|
|
|
15
15
|
interface CreateCertificateFieldsResult {
|
|
16
16
|
certificateFields: Record<CertificateFieldNameUnder50Bytes, Base64String>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Utils,
|
|
1
|
+
import type {
|
|
2
|
+
PubKeyHex,
|
|
4
3
|
Base64String,
|
|
5
4
|
CertificateFieldNameUnder50Bytes,
|
|
6
5
|
HexString,
|
|
7
6
|
OutpointString,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
} from '../../wallet/Wallet.interfaces.js'
|
|
8
|
+
import SymmetricKey from '../../primitives/SymmetricKey.js'
|
|
9
|
+
import * as Utils from '../../primitives/utils.js'
|
|
10
|
+
import ProtoWallet from '../../wallet/ProtoWallet.js'
|
|
11
11
|
import Certificate from './Certificate.js'
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
|
-
import
|
|
2
|
+
import PrivateKey from '../../../primitives/PrivateKey.js'
|
|
3
3
|
import {
|
|
4
4
|
ProtoWallet,
|
|
5
5
|
WalletInterface,
|
|
6
|
-
|
|
7
6
|
CreateActionResult,
|
|
8
|
-
|
|
9
7
|
SignActionResult,
|
|
10
|
-
|
|
11
8
|
AbortActionResult,
|
|
12
|
-
|
|
13
9
|
ListActionsResult,
|
|
14
|
-
|
|
15
10
|
InternalizeActionResult,
|
|
16
|
-
|
|
17
11
|
ListOutputsResult,
|
|
18
|
-
|
|
19
12
|
RelinquishOutputResult,
|
|
20
|
-
|
|
21
13
|
AcquireCertificateResult,
|
|
22
|
-
|
|
23
14
|
ListCertificatesResult,
|
|
24
|
-
|
|
25
15
|
ProveCertificateResult,
|
|
26
|
-
|
|
27
16
|
RelinquishCertificateResult,
|
|
28
|
-
|
|
29
17
|
DiscoverCertificatesResult,
|
|
30
|
-
|
|
31
18
|
GetHeightResult,
|
|
32
|
-
|
|
33
19
|
GetHeaderResult,
|
|
34
20
|
KeyDeriverApi,
|
|
35
21
|
KeyDeriver,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import
|
|
2
|
+
import * as Utils from '../../primitives/utils.js'
|
|
3
|
+
import Random from '../../primitives/Random.js'
|
|
4
|
+
import P2PKH from '../../script/templates/P2PKH.js'
|
|
5
|
+
import PublicKey from '../../primitives/PublicKey.js'
|
|
6
|
+
import { WalletInterface } from '../../wallet/Wallet.interfaces.js'
|
|
7
|
+
import { createNonce } from '../utils/createNonce.js'
|
|
3
8
|
import { Peer } from '../Peer.js'
|
|
4
9
|
import { SimplifiedFetchTransport } from '../transports/SimplifiedFetchTransport.js'
|
|
5
10
|
import { SessionManager } from '../SessionManager.js'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Utils,
|
|
3
|
-
Random,
|
|
4
2
|
WalletInterface,
|
|
5
3
|
WalletCounterparty,
|
|
6
4
|
Base64String
|
|
7
|
-
} from '
|
|
5
|
+
} from '../../wallet/Wallet.interfaces.js'
|
|
6
|
+
import * as Utils from '../../primitives/utils.js'
|
|
7
|
+
import Random from '../../primitives/Random.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a nonce derived from a wallet
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Utils from '../../primitives/utils.js'
|
|
2
|
+
import { WalletInterface, WalletCounterparty, Base64String } from '../../wallet/Wallet.interfaces.js'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Verifies a nonce derived from a wallet
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { AuthFetch } from '../auth/clients/index.js'
|
|
2
|
+
import { DEFAULT_IDENTITY_CLIENT_OPTIONS, defaultIdentity, DisplayableIdentity, KNOWN_IDENTITY_TYPES } from './types/index.js'
|
|
3
|
+
import {
|
|
4
|
+
CertificateFieldNameUnder50Bytes,
|
|
5
|
+
DiscoverByAttributesArgs,
|
|
6
|
+
DiscoverByIdentityKeyArgs,
|
|
7
|
+
IdentityCertificate,
|
|
8
|
+
OriginatorDomainNameStringUnder250Bytes,
|
|
9
|
+
WalletCertificate,
|
|
10
|
+
WalletClient,
|
|
11
|
+
WalletInterface
|
|
12
|
+
} from '../wallet/index.js'
|
|
13
|
+
import { BroadcastFailure, BroadcastResponse, Transaction } from '../transaction/index.js'
|
|
14
|
+
import Certificate from '../auth/certificates/Certificate.js'
|
|
15
|
+
import { PushDrop } from '../script/index.js'
|
|
16
|
+
import { PrivateKey, Utils } from '../primitives/index.js'
|
|
17
|
+
import { TopicBroadcaster } from '../overlay-tools/index.js'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* IdentityClient lets you discover who others are, and let the world know who you are.
|
|
21
|
+
*/
|
|
22
|
+
export class IdentityClient {
|
|
23
|
+
private readonly authClient: AuthFetch
|
|
24
|
+
private readonly wallet: WalletInterface
|
|
25
|
+
constructor (
|
|
26
|
+
wallet?: WalletInterface,
|
|
27
|
+
private readonly options = DEFAULT_IDENTITY_CLIENT_OPTIONS,
|
|
28
|
+
private readonly originator?: OriginatorDomainNameStringUnder250Bytes
|
|
29
|
+
) {
|
|
30
|
+
this.wallet = wallet ?? new WalletClient()
|
|
31
|
+
this.authClient = new AuthFetch(this.wallet)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Publicly reveals selected fields from a given certificate by creating a publicly verifiable certificate.
|
|
36
|
+
* The publicly revealed certificate is included in a blockchain transaction and broadcast to a federated overlay node.
|
|
37
|
+
*
|
|
38
|
+
* @param {Certificate} certificate - The master certificate to selectively reveal.
|
|
39
|
+
* @param {CertificateFieldNameUnder50Bytes[]} fieldsToReveal - An array of certificate field names to reveal. Only these fields will be included in the public certificate.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<object>} A promise that resolves with the broadcast result from the overlay network.
|
|
42
|
+
* @throws {Error} Throws an error if the certificate is invalid, the fields cannot be revealed, or if the broadcast fails.
|
|
43
|
+
*/
|
|
44
|
+
async publiclyRevealAttributes (
|
|
45
|
+
certificate: WalletCertificate,
|
|
46
|
+
fieldsToReveal: CertificateFieldNameUnder50Bytes[]
|
|
47
|
+
): Promise<BroadcastResponse | BroadcastFailure> {
|
|
48
|
+
if (Object.keys(certificate.fields).length === 0) {
|
|
49
|
+
throw new Error('Public reveal failed: Certificate has no fields to reveal!')
|
|
50
|
+
}
|
|
51
|
+
if (fieldsToReveal.length === 0) {
|
|
52
|
+
throw new Error('Public reveal failed: You must reveal at least one field!')
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const masterCert = new Certificate(
|
|
56
|
+
certificate.type,
|
|
57
|
+
certificate.serialNumber,
|
|
58
|
+
certificate.subject,
|
|
59
|
+
certificate.certifier,
|
|
60
|
+
certificate.revocationOutpoint,
|
|
61
|
+
certificate.fields,
|
|
62
|
+
certificate.signature
|
|
63
|
+
)
|
|
64
|
+
await masterCert.verify()
|
|
65
|
+
} catch (error) {
|
|
66
|
+
throw new Error('Public reveal failed: Certificate verification failed!')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Given we already have a master certificate from a certifier,
|
|
70
|
+
// create an anyone verifiable certificate with selectively revealed fields
|
|
71
|
+
const { keyringForVerifier } = await this.wallet.proveCertificate({
|
|
72
|
+
certificate,
|
|
73
|
+
fieldsToReveal,
|
|
74
|
+
verifier: new PrivateKey(1).toPublicKey().toString()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// Build the lockingScript with pushdrop.create() and the transaction with createAction()
|
|
78
|
+
const lockingScript = await new PushDrop(this.wallet).lock(
|
|
79
|
+
[Utils.toArray(JSON.stringify({ ...certificate, keyring: keyringForVerifier }))],
|
|
80
|
+
this.options.protocolID,
|
|
81
|
+
this.options.keyID,
|
|
82
|
+
'anyone',
|
|
83
|
+
true,
|
|
84
|
+
true
|
|
85
|
+
)
|
|
86
|
+
// TODO: Consider verification and if this is necessary
|
|
87
|
+
// counterpartyCanVerifyMyOwnership: true
|
|
88
|
+
|
|
89
|
+
const { tx } = await this.wallet.createAction({
|
|
90
|
+
description: 'Create a new Identity Token',
|
|
91
|
+
outputs: [{
|
|
92
|
+
satoshis: this.options.tokenAmount,
|
|
93
|
+
lockingScript: lockingScript.toHex(),
|
|
94
|
+
outputDescription: 'Identity Token'
|
|
95
|
+
}],
|
|
96
|
+
options: {
|
|
97
|
+
randomizeOutputs: false
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
if (tx !== undefined) {
|
|
102
|
+
// Submit the transaction to an overlay
|
|
103
|
+
const broadcaster = new TopicBroadcaster(['tm_identity'], {
|
|
104
|
+
networkPreset: (await (this.wallet.getNetwork({}))).network
|
|
105
|
+
})
|
|
106
|
+
return await broadcaster.broadcast(Transaction.fromAtomicBEEF(tx))
|
|
107
|
+
}
|
|
108
|
+
throw new Error('Public reveal failed: failed to create action!')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Resolves displayable identity certificates, issued to a given identity key by a trusted certifier.
|
|
113
|
+
*
|
|
114
|
+
* @param {DiscoverByIdentityKeyArgs} args - Arguments for requesting the discovery based on the identity key.
|
|
115
|
+
* @returns {Promise<DisplayableIdentity[]>} The promise resolves to displayable identities.
|
|
116
|
+
*/
|
|
117
|
+
async resolveByIdentityKey (
|
|
118
|
+
args: DiscoverByIdentityKeyArgs
|
|
119
|
+
): Promise<DisplayableIdentity[]> {
|
|
120
|
+
const { certificates } = await this.wallet.discoverByIdentityKey(args, this.originator)
|
|
121
|
+
return certificates.map(cert => {
|
|
122
|
+
return IdentityClient.parseIdentity(cert)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Resolves displayable identity certificates by specific identity attributes, issued by a trusted entity.
|
|
128
|
+
*
|
|
129
|
+
* @param {DiscoverByAttributesArgs} args - Attributes and optional parameters used to discover certificates.
|
|
130
|
+
* @returns {Promise<DisplayableIdentity[]>} The promise resolves to displayable identities.
|
|
131
|
+
*/
|
|
132
|
+
async resolveByAttributes (
|
|
133
|
+
args: DiscoverByAttributesArgs
|
|
134
|
+
): Promise<DisplayableIdentity[]> {
|
|
135
|
+
const { certificates } = await this.wallet.discoverByAttributes(args, this.originator)
|
|
136
|
+
return certificates.map(cert => {
|
|
137
|
+
return IdentityClient.parseIdentity(cert)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* TODO: Implement once revocation overlay is created
|
|
143
|
+
* Remove public certificate revelation from overlay services by spending the identity token
|
|
144
|
+
* @param serialNumber - Unique serial number of the certificate to revoke revelation
|
|
145
|
+
*/
|
|
146
|
+
// async revokeCertificateRevelation(
|
|
147
|
+
// serialNumber: Base64String
|
|
148
|
+
// ): Promise<BroadcastResponse | BroadcastFailure> {
|
|
149
|
+
// // 1. Find existing UTXO
|
|
150
|
+
// const lookupResolver = new LookupResolver()
|
|
151
|
+
// const result = await lookupResolver.query({
|
|
152
|
+
// service: 'ls_identity',
|
|
153
|
+
// query: {
|
|
154
|
+
// serialNumber
|
|
155
|
+
// }
|
|
156
|
+
// })
|
|
157
|
+
|
|
158
|
+
// let outpoint: string
|
|
159
|
+
// let lockingScript: LockingScript | undefined
|
|
160
|
+
// if (result.type === 'output-list') {
|
|
161
|
+
// const tx = Transaction.fromAtomicBEEF(result.outputs[this.options.outputIndex].beef)
|
|
162
|
+
// outpoint = `${tx.id('hex')}.${this.options.outputIndex}` // Consider better way
|
|
163
|
+
// lockingScript = tx.outputs[this.options.outputIndex].lockingScript
|
|
164
|
+
// }
|
|
165
|
+
|
|
166
|
+
// if (lockingScript === undefined) {
|
|
167
|
+
// throw new Error('Failed to get locking script for revelation output!')
|
|
168
|
+
// }
|
|
169
|
+
|
|
170
|
+
// // 2. Parse results
|
|
171
|
+
// const { signableTransaction } = await this.wallet.createAction({
|
|
172
|
+
// description: '',
|
|
173
|
+
// inputs: [{
|
|
174
|
+
// inputDescription: 'Spend certificate revelation token',
|
|
175
|
+
// outpoint,
|
|
176
|
+
// unlockingScriptLength: 73
|
|
177
|
+
// }],
|
|
178
|
+
// options: {
|
|
179
|
+
// randomizeOutputs: false
|
|
180
|
+
// }
|
|
181
|
+
// })
|
|
182
|
+
|
|
183
|
+
// if (signableTransaction === undefined) {
|
|
184
|
+
// throw new Error('Failed to create signable transaction')
|
|
185
|
+
// }
|
|
186
|
+
|
|
187
|
+
// const partialTx = Transaction.fromBEEF(signableTransaction.tx)
|
|
188
|
+
|
|
189
|
+
// const unlocker = new PushDrop(this.wallet).unlock(
|
|
190
|
+
// this.options.protocolID,
|
|
191
|
+
// this.options.keyID,
|
|
192
|
+
// 'self',
|
|
193
|
+
// 'all',
|
|
194
|
+
// false,
|
|
195
|
+
// 1,
|
|
196
|
+
// lockingScript
|
|
197
|
+
// )
|
|
198
|
+
|
|
199
|
+
// const unlockingScript = await unlocker.sign(partialTx, this.options.outputIndex)
|
|
200
|
+
|
|
201
|
+
// const { tx: signedTx } = await this.wallet.signAction({
|
|
202
|
+
// reference: signableTransaction.reference,
|
|
203
|
+
// spends: {
|
|
204
|
+
// [this.options.outputIndex]: {
|
|
205
|
+
// unlockingScript: unlockingScript.toHex()
|
|
206
|
+
// }
|
|
207
|
+
// }
|
|
208
|
+
// })
|
|
209
|
+
|
|
210
|
+
// // 4. Return broadcast status
|
|
211
|
+
// // Submit the transaction to an overlay
|
|
212
|
+
// const broadcaster = new SHIPBroadcaster(['tm_identity'])
|
|
213
|
+
// return await broadcaster.broadcast(Transaction.fromAtomicBEEF(signedTx as number[]))
|
|
214
|
+
// }
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Parse out identity and certifier attributes to display from an IdentityCertificate
|
|
218
|
+
* @param identityToParse - The Identity Certificate to parse
|
|
219
|
+
* @returns - IdentityToDisplay
|
|
220
|
+
*/
|
|
221
|
+
static parseIdentity (identityToParse: IdentityCertificate): DisplayableIdentity {
|
|
222
|
+
const { type, decryptedFields, certifierInfo } = identityToParse
|
|
223
|
+
let name, avatarURL, badgeLabel, badgeIconURL, badgeClickURL
|
|
224
|
+
|
|
225
|
+
// Parse out the name to display based on the specific certificate type which has clearly defined fields.
|
|
226
|
+
switch (type) {
|
|
227
|
+
case KNOWN_IDENTITY_TYPES.xCert:
|
|
228
|
+
name = decryptedFields.userName
|
|
229
|
+
avatarURL = decryptedFields.profilePhoto
|
|
230
|
+
badgeLabel = `X account certified by ${certifierInfo.name}`
|
|
231
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
232
|
+
badgeClickURL = 'https://socialcert.net' // TODO Make a specific page for this.
|
|
233
|
+
break
|
|
234
|
+
case KNOWN_IDENTITY_TYPES.discordCert:
|
|
235
|
+
name = decryptedFields.userName
|
|
236
|
+
avatarURL = decryptedFields.profilePhoto
|
|
237
|
+
badgeLabel = `Discord account certified by ${certifierInfo.name}`
|
|
238
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
239
|
+
badgeClickURL = 'https://socialcert.net' // TODO Make a specific page for this.
|
|
240
|
+
break
|
|
241
|
+
case KNOWN_IDENTITY_TYPES.emailCert:
|
|
242
|
+
name = decryptedFields.email
|
|
243
|
+
avatarURL = 'XUTZxep7BBghAJbSBwTjNfmcsDdRFs5EaGEgkESGSgjJVYgMEizu'
|
|
244
|
+
badgeLabel = `Email certified by ${certifierInfo.name}`
|
|
245
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
246
|
+
badgeClickURL = 'https://socialcert.net' // TODO Make a specific page for this.
|
|
247
|
+
break
|
|
248
|
+
case KNOWN_IDENTITY_TYPES.phoneCert:
|
|
249
|
+
name = decryptedFields.phoneNumber
|
|
250
|
+
avatarURL = 'XUTLxtX3ELNUwRhLwL7kWNGbdnFM8WG2eSLv84J7654oH8HaJWrU'
|
|
251
|
+
badgeLabel = `Phone certified by ${certifierInfo.name}`
|
|
252
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
253
|
+
badgeClickURL = 'https://socialcert.net' // TODO Make a specific page for this.
|
|
254
|
+
break
|
|
255
|
+
case KNOWN_IDENTITY_TYPES.identiCert:
|
|
256
|
+
name = `${decryptedFields.firstName} ${decryptedFields.lastName}`
|
|
257
|
+
avatarURL = decryptedFields.profilePhoto
|
|
258
|
+
badgeLabel = `Government ID certified by ${certifierInfo.name}`
|
|
259
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
260
|
+
badgeClickURL = 'https://identicert.me' // TODO Make a specific page for this.
|
|
261
|
+
break
|
|
262
|
+
case KNOWN_IDENTITY_TYPES.registrant:
|
|
263
|
+
name = decryptedFields.name
|
|
264
|
+
avatarURL = decryptedFields.icon
|
|
265
|
+
badgeLabel = `Entity certified by ${certifierInfo.name}`
|
|
266
|
+
badgeIconURL = certifierInfo.iconUrl
|
|
267
|
+
badgeClickURL = 'https://projectbabbage.com/docs/registrant' // TODO: Make this doc page exist
|
|
268
|
+
break
|
|
269
|
+
case KNOWN_IDENTITY_TYPES.coolCert:
|
|
270
|
+
name = decryptedFields.cool === 'true' ? 'Cool Person!' : 'Not cool!'
|
|
271
|
+
break
|
|
272
|
+
case KNOWN_IDENTITY_TYPES.anyone:
|
|
273
|
+
name = 'Anyone'
|
|
274
|
+
avatarURL = 'XUT4bpQ6cpBaXi1oMzZsXfpkWGbtp2JTUYAoN7PzhStFJ6wLfoeR'
|
|
275
|
+
badgeLabel = 'Represents the ability for anyone to access this information.'
|
|
276
|
+
badgeIconURL = 'XUUV39HVPkpmMzYNTx7rpKzJvXfeiVyQWg2vfSpjBAuhunTCA9uG'
|
|
277
|
+
badgeClickURL = 'https://projectbabbage.com/docs/anyone-identity' // TODO: Make this doc page exist
|
|
278
|
+
break
|
|
279
|
+
case KNOWN_IDENTITY_TYPES.self:
|
|
280
|
+
name = 'You'
|
|
281
|
+
avatarURL = 'XUT9jHGk2qace148jeCX5rDsMftkSGYKmigLwU2PLLBc7Hm63VYR'
|
|
282
|
+
badgeLabel = 'Represents your ability to access this information.'
|
|
283
|
+
badgeIconURL = 'XUUV39HVPkpmMzYNTx7rpKzJvXfeiVyQWg2vfSpjBAuhunTCA9uG'
|
|
284
|
+
badgeClickURL = 'https://projectbabbage.com/docs/self-identity' // TODO: Make this doc page exist
|
|
285
|
+
break
|
|
286
|
+
default:
|
|
287
|
+
name = defaultIdentity.name
|
|
288
|
+
avatarURL = decryptedFields.profilePhoto
|
|
289
|
+
badgeLabel = defaultIdentity.badgeLabel
|
|
290
|
+
badgeIconURL = defaultIdentity.badgeIconURL
|
|
291
|
+
badgeClickURL = defaultIdentity.badgeClickURL // TODO: Make this doc page exist
|
|
292
|
+
break
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
name,
|
|
297
|
+
avatarURL,
|
|
298
|
+
abbreviatedKey: identityToParse.subject.length > 0 ? `${identityToParse.subject.substring(0, 10)}...` : '',
|
|
299
|
+
identityKey: identityToParse.subject,
|
|
300
|
+
badgeIconURL,
|
|
301
|
+
badgeLabel,
|
|
302
|
+
badgeClickURL
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|