@cheqd/sdk 3.0.2-develop.1 → 3.0.2-develop.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.
- package/package.json +8 -2
- package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -74
- package/.github/ISSUE_TEMPLATE/config.yml +0 -14
- package/.github/ISSUE_TEMPLATE/feature-request.yaml +0 -27
- package/.github/dependabot.yml +0 -43
- package/.github/linters/.commitlint.rules.cjs +0 -37
- package/.github/linters/.eslintrc.json +0 -18
- package/.github/linters/.markdown-lint.yml +0 -139
- package/.github/linters/mlc_config.json +0 -13
- package/.github/workflows/build.yml +0 -26
- package/.github/workflows/cleanup-actions.yml +0 -45
- package/.github/workflows/cleanup-cache-automatic.yml +0 -24
- package/.github/workflows/cleanup-cache-manual.yml +0 -21
- package/.github/workflows/codeql.yml +0 -40
- package/.github/workflows/dispatch.yml +0 -30
- package/.github/workflows/lint.yml +0 -51
- package/.github/workflows/pull-request.yml +0 -48
- package/.github/workflows/release.yml +0 -42
- package/.github/workflows/test.yml +0 -66
- package/.releaserc.json +0 -61
- package/CHANGELOG.md +0 -320
- package/CODE_OF_CONDUCT.md +0 -81
- package/NOTICE.md +0 -10
- package/SECURITY.md +0 -12
- package/docker/Dockerfile +0 -55
- package/docker/entrypoint.sh +0 -58
- package/docker/localnet/build-latest.env +0 -7
- package/docker/localnet/container-env/observer-0.env +0 -13
- package/docker/localnet/container-env/seed-0.env +0 -17
- package/docker/localnet/container-env/validator-0.env +0 -13
- package/docker/localnet/container-env/validator-1.env +0 -13
- package/docker/localnet/container-env/validator-2.env +0 -13
- package/docker/localnet/container-env/validator-3.env +0 -13
- package/docker/localnet/docker-compose.yml +0 -281
- package/docker/localnet/gen-network-config.sh +0 -259
- package/docker/localnet/import-keys.sh +0 -31
- package/jest.config.cjs +0 -20
- package/src/index.ts +0 -192
- package/src/modules/_.ts +0 -61
- package/src/modules/did.ts +0 -601
- package/src/modules/resource.ts +0 -247
- package/src/querier.ts +0 -36
- package/src/registry.ts +0 -13
- package/src/signer.ts +0 -297
- package/src/types.ts +0 -110
- package/src/utils.ts +0 -246
- package/tests/index.test.ts +0 -155
- package/tests/modules/did.test.ts +0 -985
- package/tests/modules/resource.test.ts +0 -991
- package/tests/signer.test.ts +0 -202
- package/tests/testutils.test.ts +0 -29
- package/tests/utils.test.ts +0 -77
- package/tsconfig.cjs.json +0 -8
- package/tsconfig.esm.json +0 -8
- package/tsconfig.json +0 -84
- package/tsconfig.types.json +0 -10
package/tests/signer.test.ts
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MsgCreateDidDoc,
|
|
3
|
-
MsgCreateDidDocPayload,
|
|
4
|
-
VerificationMethod
|
|
5
|
-
} from "@cheqd/ts-proto/cheqd/did/v2"
|
|
6
|
-
import {
|
|
7
|
-
DirectSecp256k1HdWallet,
|
|
8
|
-
Registry
|
|
9
|
-
} from "@cosmjs/proto-signing"
|
|
10
|
-
import { EdDSASigner } from "did-jwt"
|
|
11
|
-
import { typeUrlMsgCreateDidDoc } from '../src/modules/did'
|
|
12
|
-
import { CheqdSigningStargateClient } from "../src/signer"
|
|
13
|
-
import {
|
|
14
|
-
ISignInputs,
|
|
15
|
-
MethodSpecificIdAlgo,
|
|
16
|
-
VerificationMethods
|
|
17
|
-
} from "../src/types"
|
|
18
|
-
import {
|
|
19
|
-
fromString,
|
|
20
|
-
toString
|
|
21
|
-
} from 'uint8arrays'
|
|
22
|
-
import {
|
|
23
|
-
createDidPayload,
|
|
24
|
-
createDidVerificationMethod,
|
|
25
|
-
createKeyPairBase64,
|
|
26
|
-
createVerificationKeys,
|
|
27
|
-
validateSpecCompliantPayload
|
|
28
|
-
} from '../src/utils';
|
|
29
|
-
import {
|
|
30
|
-
localnet,
|
|
31
|
-
faucet
|
|
32
|
-
} from "./testutils.test"
|
|
33
|
-
import { verify } from "@stablelib/ed25519"
|
|
34
|
-
import { v4 } from "uuid"
|
|
35
|
-
|
|
36
|
-
const nonExistingDid = "did:cHeQd:fantasticnet:123"
|
|
37
|
-
const nonExistingKeyId = 'did:cHeQd:fantasticnet:123#key-678'
|
|
38
|
-
const nonExistingPublicKeyMultibase = '1234567890'
|
|
39
|
-
const nonExistingVerificationMethod = 'ExtraTerrestrialVerificationKey2045'
|
|
40
|
-
const nonExistingVerificationDidDocument = {
|
|
41
|
-
"authentication": [
|
|
42
|
-
"did:cheqd:testnet:z6Jn6NmYkaCepQe2#key-1"
|
|
43
|
-
],
|
|
44
|
-
"controller": [
|
|
45
|
-
"did:cheqd:testnet:z6Jn6NmYkaCepQe2"
|
|
46
|
-
],
|
|
47
|
-
"id": "did:cheqd:testnet:z6Jn6NmYkaCepQe2",
|
|
48
|
-
"verificationMethod": [
|
|
49
|
-
{
|
|
50
|
-
"controller": "did:cheqd:testnet:z6Jn6NmYkaCepQe2",
|
|
51
|
-
"id": "did:cheqd:testnet:z6Jn6NmYkaCepQe2#key-1",
|
|
52
|
-
"publicKeyMultibase": "z6Jn6NmYkaCepQe29vgCZQhFfRkN3YpEPiu14F8HbbmqW",
|
|
53
|
-
"type": nonExistingVerificationMethod
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
describe('CheqdSigningStargateClient', () => {
|
|
59
|
-
describe('constructor', () => {
|
|
60
|
-
it('can be instantiated & works for cheqd networks', async () => {
|
|
61
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
62
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
63
|
-
expect(signer).toBeInstanceOf(CheqdSigningStargateClient)
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('can be constructed with cheqd custom registry', async () => {
|
|
67
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
68
|
-
const registry = new Registry()
|
|
69
|
-
registry.register(typeUrlMsgCreateDidDoc, MsgCreateDidDoc)
|
|
70
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet, { registry })
|
|
71
|
-
expect(signer.registry.lookupType(typeUrlMsgCreateDidDoc)).toBe(MsgCreateDidDoc)
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
describe('getDidSigner', () => {
|
|
76
|
-
it('can get a signer for a did', async () => {
|
|
77
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
78
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
79
|
-
const keyPair = createKeyPairBase64()
|
|
80
|
-
const verificationKeys = createVerificationKeys(keyPair.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
81
|
-
const verificationMethods = createDidVerificationMethod([VerificationMethods.Ed255192020], [verificationKeys])
|
|
82
|
-
const didPayload = createDidPayload(verificationMethods, [verificationKeys])
|
|
83
|
-
const { protobufVerificationMethod } = validateSpecCompliantPayload(didPayload)
|
|
84
|
-
|
|
85
|
-
const didSigner = await signer.getDidSigner(didPayload.verificationMethod![0].id, protobufVerificationMethod!)
|
|
86
|
-
|
|
87
|
-
expect(didSigner).toBe(EdDSASigner)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('should throw for a non-supported verification method', async () => {
|
|
91
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
92
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
93
|
-
|
|
94
|
-
await expect(signer.getDidSigner(nonExistingVerificationDidDocument.verificationMethod[0].id, nonExistingVerificationDidDocument.verificationMethod)).rejects.toThrow()
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('should throw for non-matching verification method id', async () => {
|
|
98
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
99
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
100
|
-
const keyPair = createKeyPairBase64()
|
|
101
|
-
const verificationKeys = createVerificationKeys(keyPair.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
102
|
-
const verificationMethods = createDidVerificationMethod([VerificationMethods.Ed255192020], [verificationKeys])
|
|
103
|
-
const payload = createDidPayload(verificationMethods, [verificationKeys])
|
|
104
|
-
const { protobufVerificationMethod } = validateSpecCompliantPayload(payload)
|
|
105
|
-
|
|
106
|
-
await expect(signer.getDidSigner(nonExistingKeyId, protobufVerificationMethod!)).rejects.toThrow()
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
describe('checkDidSigners', () => {
|
|
111
|
-
it('it should instantiate a signer for a did', async () => {
|
|
112
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
113
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
114
|
-
const keyPair = createKeyPairBase64()
|
|
115
|
-
const verificationKeys = createVerificationKeys(keyPair.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
116
|
-
const verificationMethods = createDidVerificationMethod([VerificationMethods.Ed255192020], [verificationKeys])
|
|
117
|
-
const payload = createDidPayload(verificationMethods, [verificationKeys])
|
|
118
|
-
const { protobufVerificationMethod } = validateSpecCompliantPayload(payload)
|
|
119
|
-
const didSigners = await signer.checkDidSigners(protobufVerificationMethod)
|
|
120
|
-
|
|
121
|
-
expect(didSigners[VerificationMethods.Ed255192020]).toBe(EdDSASigner)
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it('should instantiate multiple signers for a did with multiple verification methods', async () => {
|
|
125
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
126
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
127
|
-
const keyPair1 = createKeyPairBase64()
|
|
128
|
-
const keyPair2 = createKeyPairBase64()
|
|
129
|
-
const keyPair3 = createKeyPairBase64()
|
|
130
|
-
const verificationKeys1 = createVerificationKeys(keyPair1.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
131
|
-
const verificationKeys2 = createVerificationKeys(keyPair2.publicKey, MethodSpecificIdAlgo.Base58, 'key-2')
|
|
132
|
-
const verificationKeys3 = createVerificationKeys(keyPair3.publicKey, MethodSpecificIdAlgo.Base58, 'key-3')
|
|
133
|
-
const verificationMethods = createDidVerificationMethod([VerificationMethods.Ed255192020, VerificationMethods.JWK, VerificationMethods.Ed255192018], [verificationKeys1, verificationKeys2, verificationKeys3])
|
|
134
|
-
|
|
135
|
-
const payload = createDidPayload(verificationMethods, [verificationKeys1, verificationKeys2, verificationKeys3])
|
|
136
|
-
const { protobufVerificationMethod } = validateSpecCompliantPayload(payload)
|
|
137
|
-
|
|
138
|
-
const didSigners = await signer.checkDidSigners(protobufVerificationMethod)
|
|
139
|
-
|
|
140
|
-
expect(didSigners[VerificationMethods.Ed255192020]).toBe(EdDSASigner)
|
|
141
|
-
expect(didSigners[VerificationMethods.JWK]).toBe(EdDSASigner)
|
|
142
|
-
expect(didSigners[VerificationMethods.Ed255192018]).toBe(EdDSASigner)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
it('should throw for non-supported verification method', async () => {
|
|
146
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
147
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
148
|
-
const verificationMethod: Partial<VerificationMethod> = {
|
|
149
|
-
id: nonExistingKeyId,
|
|
150
|
-
verificationMethodType: nonExistingVerificationMethod,
|
|
151
|
-
controller: nonExistingDid,
|
|
152
|
-
verificationMaterial: JSON.stringify({publicKeyMultibase: nonExistingPublicKeyMultibase})
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
await expect(signer.checkDidSigners([VerificationMethod.fromPartial(verificationMethod)])).rejects.toThrow()
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
describe('signcreateDidDocTx', () => {
|
|
160
|
-
it('should sign a did tx with valid signature', async () => {
|
|
161
|
-
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic)
|
|
162
|
-
const signer = await CheqdSigningStargateClient.connectWithSigner(localnet.rpcUrl, wallet)
|
|
163
|
-
const keyPair = createKeyPairBase64()
|
|
164
|
-
const verificationKeys = createVerificationKeys(keyPair.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
165
|
-
const verificationMethods = createDidVerificationMethod([VerificationMethods.Ed255192020], [verificationKeys])
|
|
166
|
-
const didPayload = createDidPayload(verificationMethods, [verificationKeys])
|
|
167
|
-
const signInputs: ISignInputs[] = [
|
|
168
|
-
{
|
|
169
|
-
verificationMethodId: didPayload.verificationMethod![0].id,
|
|
170
|
-
privateKeyHex: toString(fromString(keyPair.privateKey, 'base64'), 'hex')
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
const { protobufVerificationMethod, protobufService } = validateSpecCompliantPayload(didPayload)
|
|
174
|
-
const versionId = v4()
|
|
175
|
-
const payload = MsgCreateDidDocPayload.fromPartial({
|
|
176
|
-
context: <string[]>didPayload?.['@context'],
|
|
177
|
-
id: didPayload.id,
|
|
178
|
-
controller: <string[]>didPayload.controller,
|
|
179
|
-
verificationMethod: protobufVerificationMethod,
|
|
180
|
-
authentication: <string[]>didPayload.authentication,
|
|
181
|
-
assertionMethod: <string[]>didPayload.assertionMethod,
|
|
182
|
-
capabilityInvocation: <string[]>didPayload.capabilityInvocation,
|
|
183
|
-
capabilityDelegation: <string[]>didPayload.capabilityDelegation,
|
|
184
|
-
keyAgreement: <string[]>didPayload.keyAgreement,
|
|
185
|
-
service: protobufService,
|
|
186
|
-
alsoKnownAs: <string[]>didPayload.alsoKnownAs,
|
|
187
|
-
versionId: versionId
|
|
188
|
-
})
|
|
189
|
-
const signInfos = await signer.signcreateDidDocTx(signInputs, payload)
|
|
190
|
-
const publicKeyRaw = fromString(keyPair.publicKey, 'base64')
|
|
191
|
-
const messageRaw = MsgCreateDidDocPayload.encode(payload).finish()
|
|
192
|
-
|
|
193
|
-
const verified = verify(
|
|
194
|
-
publicKeyRaw,
|
|
195
|
-
messageRaw,
|
|
196
|
-
signInfos[0].signature
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
expect(verified).toBe(true)
|
|
200
|
-
})
|
|
201
|
-
})
|
|
202
|
-
})
|
package/tests/testutils.test.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { GasPrice } from "@cosmjs/stargate"
|
|
2
|
-
|
|
3
|
-
export const faucet = {
|
|
4
|
-
prefix: 'cheqd',
|
|
5
|
-
minimalDenom: 'ncheq',
|
|
6
|
-
mnemonic: 'sketch mountain erode window enact net enrich smoke claim kangaroo another visual write meat latin bacon pulp similar forum guilt father state erase bright',
|
|
7
|
-
address: 'cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const localnet = {
|
|
11
|
-
network: 'testnet',
|
|
12
|
-
rpcUrl: 'http://localhost:26657',
|
|
13
|
-
gasPrice: GasPrice.fromString( `50${faucet.minimalDenom}` )
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const json_content = "{\"message\": \"hello world\"}"
|
|
17
|
-
|
|
18
|
-
export const image_content = 'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAAA1BMVEW10NBjBBbqAAAAH0lEQVRoge3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAvg0hAAABmmDh1QAAAABJRU5ErkJggg' as const
|
|
19
|
-
|
|
20
|
-
export const default_content = '<p>Test file content</p>'
|
|
21
|
-
|
|
22
|
-
export function containsAll<T>(array: T[], values: T[]): boolean {
|
|
23
|
-
return values.every(value => array.includes(value))
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function containsAllButOmittedFields<T extends Record<string, any>>(array: T[], values: T[], omit: string[]): boolean {
|
|
27
|
-
const replacer = (key: string, value: any) => omit.includes(key) ? undefined : value
|
|
28
|
-
return values.every(value => array.some(item => JSON.stringify(item, replacer) === JSON.stringify(value, replacer)))
|
|
29
|
-
}
|
package/tests/utils.test.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TImportableEd25519Key,
|
|
3
|
-
createSignInputsFromImportableEd25519Key
|
|
4
|
-
} from '../src/utils'
|
|
5
|
-
import {
|
|
6
|
-
createDidVerificationMethod,
|
|
7
|
-
createVerificationKeys,
|
|
8
|
-
createKeyPairRaw
|
|
9
|
-
} from '../src/utils'
|
|
10
|
-
import { toString } from 'uint8arrays'
|
|
11
|
-
import {
|
|
12
|
-
IKeyPair,
|
|
13
|
-
MethodSpecificIdAlgo,
|
|
14
|
-
VerificationMethods
|
|
15
|
-
} from '../src/types'
|
|
16
|
-
|
|
17
|
-
describe('createSignInputsFromImportableEd25519Key', () => {
|
|
18
|
-
it('should create a sign input from an importable ed25519 key 2020', async () => {
|
|
19
|
-
const keyPair = createKeyPairRaw()
|
|
20
|
-
const importableEd25519Key: TImportableEd25519Key = {
|
|
21
|
-
publicKeyHex: toString(keyPair.publicKey, 'hex'),
|
|
22
|
-
privateKeyHex: toString(keyPair.secretKey, 'hex'),
|
|
23
|
-
kid: toString(keyPair.publicKey, 'hex'),
|
|
24
|
-
type: 'Ed25519'
|
|
25
|
-
}
|
|
26
|
-
const keyPairBase64: IKeyPair = {
|
|
27
|
-
publicKey: toString(keyPair.publicKey, 'base64'),
|
|
28
|
-
privateKey: toString(keyPair.secretKey, 'base64'),
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const verificationKeys = createVerificationKeys(keyPairBase64.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
32
|
-
const verificationMethod = createDidVerificationMethod([VerificationMethods.Ed255192020], [verificationKeys])
|
|
33
|
-
const signInput = createSignInputsFromImportableEd25519Key(importableEd25519Key, verificationMethod)
|
|
34
|
-
|
|
35
|
-
expect(signInput).toEqual({ verificationMethodId: verificationKeys.keyId, privateKeyHex: importableEd25519Key.privateKeyHex })
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('should create a sign input from an importable ed25519 key 2018', async () => {
|
|
39
|
-
const keyPair = createKeyPairRaw()
|
|
40
|
-
const importableEd25519Key: TImportableEd25519Key = {
|
|
41
|
-
publicKeyHex: toString(keyPair.publicKey, 'hex'),
|
|
42
|
-
privateKeyHex: toString(keyPair.secretKey, 'hex'),
|
|
43
|
-
kid: toString(keyPair.publicKey, 'hex'),
|
|
44
|
-
type: 'Ed25519'
|
|
45
|
-
}
|
|
46
|
-
const keyPairBase64: IKeyPair = {
|
|
47
|
-
publicKey: toString(keyPair.publicKey, 'base64'),
|
|
48
|
-
privateKey: toString(keyPair.secretKey, 'base64'),
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const verificationKeys = createVerificationKeys(keyPairBase64.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
52
|
-
const verificationMethod = createDidVerificationMethod([VerificationMethods.Ed255192018], [verificationKeys])
|
|
53
|
-
const signInput = createSignInputsFromImportableEd25519Key(importableEd25519Key, verificationMethod)
|
|
54
|
-
|
|
55
|
-
expect(signInput).toEqual({ verificationMethodId: verificationKeys.keyId, privateKeyHex: importableEd25519Key.privateKeyHex })
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('should create a sign input from an importable ed25519 key with VM type JWK', () => {
|
|
59
|
-
const keyPair = createKeyPairRaw()
|
|
60
|
-
const importableEd25519Key: TImportableEd25519Key = {
|
|
61
|
-
publicKeyHex: toString(keyPair.publicKey, 'hex'),
|
|
62
|
-
privateKeyHex: toString(keyPair.secretKey, 'hex'),
|
|
63
|
-
kid: toString(keyPair.publicKey, 'hex'),
|
|
64
|
-
type: 'Ed25519'
|
|
65
|
-
}
|
|
66
|
-
const keyPairBase64: IKeyPair = {
|
|
67
|
-
publicKey: toString(keyPair.publicKey, 'base64'),
|
|
68
|
-
privateKey: toString(keyPair.secretKey, 'base64'),
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const verificationKeys = createVerificationKeys(keyPairBase64.publicKey, MethodSpecificIdAlgo.Base58, 'key-1')
|
|
72
|
-
const verificationMethod = createDidVerificationMethod([VerificationMethods.JWK], [verificationKeys])
|
|
73
|
-
const signInput = createSignInputsFromImportableEd25519Key(importableEd25519Key, verificationMethod)
|
|
74
|
-
|
|
75
|
-
expect(signInput).toEqual({ verificationMethodId: verificationKeys.keyId, privateKeyHex: importableEd25519Key.privateKeyHex })
|
|
76
|
-
})
|
|
77
|
-
})
|
package/tsconfig.cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
5
|
-
"outDir": "build/cjs", /* Redirect output structure to the directory. */
|
|
6
|
-
"target": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
7
|
-
}
|
|
8
|
-
}
|
package/tsconfig.esm.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
5
|
-
"outDir": "build/esm", /* Redirect output structure to the directory. */
|
|
6
|
-
"target": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
7
|
-
}
|
|
8
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Basic Options */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
// "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
// "module": "nodenext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
-
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
-
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
-
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
-
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
// "outDir": "build", /* Redirect output structure to the directory. */
|
|
18
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
|
-
// "composite": true, /* Enable project compilation */
|
|
20
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
-
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
-
|
|
27
|
-
/* Strict Type-Checking Options */
|
|
28
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
29
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
-
|
|
37
|
-
/* Additional Checks */
|
|
38
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
43
|
-
|
|
44
|
-
/* Module Resolution Options */
|
|
45
|
-
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
46
|
-
"resolveJsonModule": true, /* Include modules imported with '.json' extension. */
|
|
47
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
48
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
49
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
50
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
51
|
-
"types": [
|
|
52
|
-
"@types/node",
|
|
53
|
-
"@types/jest",
|
|
54
|
-
], /* Type declaration files to be included in compilation. */
|
|
55
|
-
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
56
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
57
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
58
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
59
|
-
|
|
60
|
-
/* Source Map Options */
|
|
61
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
62
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
63
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
64
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
65
|
-
|
|
66
|
-
/* Experimental Options */
|
|
67
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
68
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
69
|
-
|
|
70
|
-
/* Advanced Options */
|
|
71
|
-
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
72
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
73
|
-
},
|
|
74
|
-
"ts-node": {
|
|
75
|
-
"esm": true,
|
|
76
|
-
"experimentalSpecifierResolution": "node"
|
|
77
|
-
},
|
|
78
|
-
"include": [
|
|
79
|
-
"src"
|
|
80
|
-
],
|
|
81
|
-
"exclude": [
|
|
82
|
-
"tests"
|
|
83
|
-
]
|
|
84
|
-
}
|