1 | import * as crypto from '../crypto/index'
|
2 | import { publicKeyToDid } from './transformers'
|
3 | import { toKeyType } from './util'
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export async function exchange(): Promise<string> {
|
10 | const pubKeyB64 = await crypto.keystore.publicReadKey()
|
11 | const ksAlg = await crypto.keystore.getAlg()
|
12 |
|
13 | return publicKeyToDid(
|
14 | pubKeyB64,
|
15 | toKeyType(ksAlg)
|
16 | )
|
17 | }
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export { write as ucan }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | export async function write(): Promise<string> {
|
28 | const pubKeyB64 = await crypto.keystore.publicWriteKey()
|
29 | const ksAlg = await crypto.keystore.getAlg()
|
30 |
|
31 | return publicKeyToDid(
|
32 | pubKeyB64,
|
33 | toKeyType(ksAlg)
|
34 | )
|
35 | }
|