@originator-profile/opvc 0.5.3 → 0.6.0-beta.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/README.md +246 -6
- package/bin/dev.cmd +1 -1
- package/bin/dev.ts +1 -1
- package/dist/commands/ca/{sign.mjs → sign.js} +2 -2
- package/dist/commands/ca/{unsigned.mjs → unsigned.js} +2 -2
- package/dist/commands/{sign.mjs → sign.js} +1 -1
- package/dist/commands/wsp/sign.d.ts +29 -0
- package/dist/commands/wsp/sign.js +93 -0
- package/dist/commands/wsp/{unsigned.mjs → unsigned.js} +24 -3
- package/dist/{content-attestation-duY49Hxp.mjs → content-attestation-Dd-YcVIv.js} +3 -16
- package/dist/{index.d.mts → index.d.ts} +30 -19
- package/dist/{index.mjs → index.js} +2 -2
- package/dist/timing-options-BWzawYM4.js +19 -0
- package/dist/website-profile-Brt0iuRN.js +60 -0
- package/package.json +20 -18
- package/dist/website-profile-B3Q2-h2n.mjs +0 -28
- /package/dist/{chunk-CfYAbeIz.mjs → chunk-pbuEa-1d.js} +0 -0
- /package/dist/commands/ca/{sign.d.mts → sign.d.ts} +0 -0
- /package/dist/commands/ca/{unsigned.d.mts → unsigned.d.ts} +0 -0
- /package/dist/commands/key-gen/{index.d.mts → index.d.ts} +0 -0
- /package/dist/commands/key-gen/{index.mjs → index.js} +0 -0
- /package/dist/commands/{sign.d.mts → sign.d.ts} +0 -0
- /package/dist/commands/wsp/{unsigned.d.mts → unsigned.d.ts} +0 -0
- /package/dist/{flags-BGhMpQzg.mjs → flags-BSM3ANoc.js} +0 -0
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ opvc
|
|
|
34
34
|
* [`opvc help [COMMAND]`](#opvc-help-command)
|
|
35
35
|
* [`opvc key-gen`](#opvc-key-gen)
|
|
36
36
|
* [`opvc sign`](#opvc-sign)
|
|
37
|
+
* [`opvc wsp:sign`](#opvc-wspsign)
|
|
37
38
|
* [`opvc wsp:unsigned`](#opvc-wspunsigned)
|
|
38
39
|
|
|
39
40
|
## `opvc ca:sign`
|
|
@@ -122,7 +123,7 @@ FLAG DESCRIPTIONS
|
|
|
122
123
|
}
|
|
123
124
|
```
|
|
124
125
|
|
|
125
|
-
_See code: [src/commands/ca/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.
|
|
126
|
+
_See code: [src/commands/ca/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/ca/sign.ts)_
|
|
126
127
|
|
|
127
128
|
## `opvc ca:unsigned`
|
|
128
129
|
|
|
@@ -207,7 +208,7 @@ FLAG DESCRIPTIONS
|
|
|
207
208
|
}
|
|
208
209
|
```
|
|
209
210
|
|
|
210
|
-
_See code: [src/commands/ca/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.
|
|
211
|
+
_See code: [src/commands/ca/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/ca/unsigned.ts)_
|
|
211
212
|
|
|
212
213
|
## `opvc help [COMMAND]`
|
|
213
214
|
|
|
@@ -227,7 +228,7 @@ DESCRIPTION
|
|
|
227
228
|
Display help for opvc.
|
|
228
229
|
```
|
|
229
230
|
|
|
230
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.
|
|
231
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.48/src/commands/help.ts)_
|
|
231
232
|
|
|
232
233
|
## `opvc key-gen`
|
|
233
234
|
|
|
@@ -245,7 +246,7 @@ DESCRIPTION
|
|
|
245
246
|
鍵ペアの生成
|
|
246
247
|
```
|
|
247
248
|
|
|
248
|
-
_See code: [src/commands/key-gen/index.ts](https://github.com/originator-profile/originator-profile/blob/v0.
|
|
249
|
+
_See code: [src/commands/key-gen/index.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/key-gen/index.ts)_
|
|
249
250
|
|
|
250
251
|
## `opvc sign`
|
|
251
252
|
|
|
@@ -412,7 +413,145 @@ FLAG DESCRIPTIONS
|
|
|
412
413
|
}
|
|
413
414
|
```
|
|
414
415
|
|
|
415
|
-
_See code: [src/commands/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.
|
|
416
|
+
_See code: [src/commands/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/sign.ts)_
|
|
417
|
+
|
|
418
|
+
## `opvc wsp:sign`
|
|
419
|
+
|
|
420
|
+
Website Profile の作成
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
USAGE
|
|
424
|
+
$ opvc wsp:sign -i <value> --input <filepath> [--issued-at <value>] [--expired-at <value>]
|
|
425
|
+
|
|
426
|
+
FLAGS
|
|
427
|
+
-i, --identity=<value> (required) プライベート鍵のファイルパス
|
|
428
|
+
--expired-at=<value> 有効期限 (ISO 8601)
|
|
429
|
+
--input=<filepath> (required) 入力ファイルのパス (JSON 形式)
|
|
430
|
+
--issued-at=<value> 発行日時 (ISO 8601)
|
|
431
|
+
|
|
432
|
+
DESCRIPTION
|
|
433
|
+
Website Profile の作成
|
|
434
|
+
|
|
435
|
+
Website Profile に署名します。
|
|
436
|
+
入力が単一オブジェクトの場合は JWT を、配列の場合は JWT の配列を標準出力に出力します。
|
|
437
|
+
配列入力時は全要素が同一の issuer / credentialSubject.id を持ち、
|
|
438
|
+
@context の @language がそれぞれ異なる必要があります。
|
|
439
|
+
|
|
440
|
+
EXAMPLES
|
|
441
|
+
$ opvc wsp:sign \
|
|
442
|
+
-i account-key.example.priv.json \
|
|
443
|
+
--input website-profile.example.json
|
|
444
|
+
|
|
445
|
+
$ opvc wsp:sign \
|
|
446
|
+
-i account-key.example.priv.json \
|
|
447
|
+
--input website-profile.multilingual.example.json
|
|
448
|
+
|
|
449
|
+
FLAG DESCRIPTIONS
|
|
450
|
+
-i, --identity=<value> プライベート鍵のファイルパス
|
|
451
|
+
|
|
452
|
+
プライベート鍵のファイルパスを渡してください。プライベート鍵は JWK 形式か、PEM base64 でエンコードされた PKCS #8
|
|
453
|
+
形式にしてください。
|
|
454
|
+
|
|
455
|
+
--expired-at=<value> 有効期限 (ISO 8601)
|
|
456
|
+
|
|
457
|
+
日付のみの場合、その日の 24:00:00.000 より前まで有効、それ以外の場合、期限切れとなる日付・時刻・秒を指定します。
|
|
458
|
+
|
|
459
|
+
--input=<filepath> 入力ファイルのパス (JSON 形式)
|
|
460
|
+
|
|
461
|
+
Website Profile (WSP) の例:
|
|
462
|
+
|
|
463
|
+
{
|
|
464
|
+
"@context": [
|
|
465
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
466
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
467
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
468
|
+
{
|
|
469
|
+
"@language": "ja"
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
"type": [
|
|
473
|
+
"VerifiableCredential",
|
|
474
|
+
"WebsiteProfile"
|
|
475
|
+
],
|
|
476
|
+
"issuer": "dns:example.com",
|
|
477
|
+
"credentialSubject": {
|
|
478
|
+
"id": "https://media.example.com/",
|
|
479
|
+
"type": "WebSite",
|
|
480
|
+
"name": "<Webサイトのタイトル>",
|
|
481
|
+
"description": "<Webサイトの説明>",
|
|
482
|
+
"image": {
|
|
483
|
+
"id": "https://media.example.com/image.png",
|
|
484
|
+
"digestSRI": "sha256-Upwn7gYMuRmJlD1ZivHk876vXHzokXrwXj50VgfnMnY="
|
|
485
|
+
},
|
|
486
|
+
"allowedOrigin": [
|
|
487
|
+
"https://media.example.com"
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
多言語 Website Profile (配列) の例:
|
|
493
|
+
|
|
494
|
+
[
|
|
495
|
+
{
|
|
496
|
+
"@context": [
|
|
497
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
498
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
499
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
500
|
+
{
|
|
501
|
+
"@language": "ja"
|
|
502
|
+
}
|
|
503
|
+
],
|
|
504
|
+
"type": [
|
|
505
|
+
"VerifiableCredential",
|
|
506
|
+
"WebsiteProfile"
|
|
507
|
+
],
|
|
508
|
+
"issuer": "dns:example.com",
|
|
509
|
+
"credentialSubject": {
|
|
510
|
+
"id": "https://media.example.com/",
|
|
511
|
+
"type": "WebSite",
|
|
512
|
+
"name": "<Webサイトのタイトル>",
|
|
513
|
+
"description": "<Webサイトの説明>",
|
|
514
|
+
"image": {
|
|
515
|
+
"id": "https://media.example.com/image.png",
|
|
516
|
+
"digestSRI": "sha256-Upwn7gYMuRmJlD1ZivHk876vXHzokXrwXj50VgfnMnY="
|
|
517
|
+
},
|
|
518
|
+
"allowedOrigin": [
|
|
519
|
+
"https://media.example.com"
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"@context": [
|
|
525
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
526
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
527
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
528
|
+
{
|
|
529
|
+
"@language": "en"
|
|
530
|
+
}
|
|
531
|
+
],
|
|
532
|
+
"type": [
|
|
533
|
+
"VerifiableCredential",
|
|
534
|
+
"WebsiteProfile"
|
|
535
|
+
],
|
|
536
|
+
"issuer": "dns:example.com",
|
|
537
|
+
"credentialSubject": {
|
|
538
|
+
"id": "https://media.example.com/",
|
|
539
|
+
"type": "WebSite",
|
|
540
|
+
"name": "<Website title>",
|
|
541
|
+
"description": "<Website description>",
|
|
542
|
+
"image": {
|
|
543
|
+
"id": "https://media.example.com/image.png",
|
|
544
|
+
"digestSRI": "sha256-Upwn7gYMuRmJlD1ZivHk876vXHzokXrwXj50VgfnMnY="
|
|
545
|
+
},
|
|
546
|
+
"allowedOrigin": [
|
|
547
|
+
"https://media.example.com"
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
_See code: [src/commands/wsp/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/wsp/sign.ts)_
|
|
416
555
|
|
|
417
556
|
## `opvc wsp:unsigned`
|
|
418
557
|
|
|
@@ -475,9 +614,74 @@ FLAG DESCRIPTIONS
|
|
|
475
614
|
]
|
|
476
615
|
}
|
|
477
616
|
}
|
|
617
|
+
|
|
618
|
+
多言語の Website Profile (配列) の例:
|
|
619
|
+
|
|
620
|
+
[
|
|
621
|
+
{
|
|
622
|
+
"@context": [
|
|
623
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
624
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
625
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
626
|
+
{
|
|
627
|
+
"@language": "ja"
|
|
628
|
+
}
|
|
629
|
+
],
|
|
630
|
+
"type": [
|
|
631
|
+
"VerifiableCredential",
|
|
632
|
+
"WebsiteProfile"
|
|
633
|
+
],
|
|
634
|
+
"issuer": "<OP ID>",
|
|
635
|
+
"credentialSubject": {
|
|
636
|
+
"id": "<Web サイトのオリジン (形式: https://<ホスト名>)>",
|
|
637
|
+
"type": "WebSite",
|
|
638
|
+
"name": "<Web サイトの名称>",
|
|
639
|
+
"description": "<Web サイトの説明>",
|
|
640
|
+
"image": {
|
|
641
|
+
"id": "<サムネイル画像URL>",
|
|
642
|
+
"content": [
|
|
643
|
+
"<コンテンツ (data:// 形式URL)>"
|
|
644
|
+
]
|
|
645
|
+
},
|
|
646
|
+
"allowedOrigin": [
|
|
647
|
+
"<Web サイトのオリジン (形式: https://<ホスト名>)>"
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"@context": [
|
|
653
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
654
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
655
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
656
|
+
{
|
|
657
|
+
"@language": "en"
|
|
658
|
+
}
|
|
659
|
+
],
|
|
660
|
+
"type": [
|
|
661
|
+
"VerifiableCredential",
|
|
662
|
+
"WebsiteProfile"
|
|
663
|
+
],
|
|
664
|
+
"issuer": "<OP ID>",
|
|
665
|
+
"credentialSubject": {
|
|
666
|
+
"id": "<Web サイトのオリジン (形式: https://<ホスト名>)>",
|
|
667
|
+
"type": "WebSite",
|
|
668
|
+
"name": "<Web サイトの名称>",
|
|
669
|
+
"description": "<Web サイトの説明>",
|
|
670
|
+
"image": {
|
|
671
|
+
"id": "<サムネイル画像URL>",
|
|
672
|
+
"content": [
|
|
673
|
+
"<コンテンツ (data:// 形式URL)>"
|
|
674
|
+
]
|
|
675
|
+
},
|
|
676
|
+
"allowedOrigin": [
|
|
677
|
+
"<Web サイトのオリジン (形式: https://<ホスト名>)>"
|
|
678
|
+
]
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
]
|
|
478
682
|
```
|
|
479
683
|
|
|
480
|
-
_See code: [src/commands/wsp/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.
|
|
684
|
+
_See code: [src/commands/wsp/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.0-beta.1/packages/opvc/src/commands/wsp/unsigned.ts)_
|
|
481
685
|
<!-- commandsstop -->
|
|
482
686
|
<!-- prettier-ignore-end -->
|
|
483
687
|
|
|
@@ -485,6 +689,19 @@ _See code: [src/commands/wsp/unsigned.ts](https://github.com/originator-profile/
|
|
|
485
689
|
|
|
486
690
|
`@originator-profile/opvc` は TypeScript/JavaScript からも利用できます。
|
|
487
691
|
|
|
692
|
+
### ローカル環境でのWebsite Profileの署名
|
|
693
|
+
|
|
694
|
+
ローカルのプライベート鍵で署名する場合は `WebsiteProfile.sign()` を使います。
|
|
695
|
+
|
|
696
|
+
```ts
|
|
697
|
+
import { WebsiteProfile } from "@originator-profile/opvc";
|
|
698
|
+
|
|
699
|
+
const jwt = await WebsiteProfile.sign(input, privateKey, {
|
|
700
|
+
issuedAt: new Date(),
|
|
701
|
+
expiredAt: "2027-03-31",
|
|
702
|
+
});
|
|
703
|
+
```
|
|
704
|
+
|
|
488
705
|
### ローカル環境でのContent Attestationの署名
|
|
489
706
|
|
|
490
707
|
ローカルのプライベート鍵で署名する場合は `ContentAttestation.sign()` を使います。
|
|
@@ -527,6 +744,29 @@ const jwt = await ContentAttestation.signByServer(input, {
|
|
|
527
744
|
});
|
|
528
745
|
```
|
|
529
746
|
|
|
747
|
+
### Website Profile の署名 (単一 / 多言語)
|
|
748
|
+
|
|
749
|
+
`WebsiteProfile.sign()` は単一の未署名 Website Profile を JWT 文字列として署名するほか、
|
|
750
|
+
配列を渡すと JWT 文字列の配列を返します。これは SiteProfile の `sites` に直接組み込めます。
|
|
751
|
+
配列入力時は全要素が同一の `issuer` / `credentialSubject.id` を持ち、
|
|
752
|
+
`@context` の `@language` がそれぞれ異なる必要があります。
|
|
753
|
+
|
|
754
|
+
```ts
|
|
755
|
+
import { WebsiteProfile } from "@originator-profile/opvc";
|
|
756
|
+
|
|
757
|
+
// 単一の場合: JWT 文字列を返します
|
|
758
|
+
const jwt = await WebsiteProfile.sign(input, privateKey, {
|
|
759
|
+
issuedAt: new Date(),
|
|
760
|
+
expiredAt: "2027-03-31",
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
// 多言語の場合: JWT 文字列の配列を返します
|
|
764
|
+
const sites = await WebsiteProfile.sign([inputJa, inputEn], privateKey, {
|
|
765
|
+
issuedAt: new Date(),
|
|
766
|
+
expiredAt: "2027-03-31",
|
|
767
|
+
});
|
|
768
|
+
```
|
|
769
|
+
|
|
530
770
|
## Development
|
|
531
771
|
|
|
532
772
|
```sh
|
package/bin/dev.cmd
CHANGED
package/bin/dev.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as sign } from "../../content-attestation-
|
|
2
|
-
import { r as privateKey, t as expirationDate } from "../../flags-
|
|
1
|
+
import { n as sign } from "../../content-attestation-Dd-YcVIv.js";
|
|
2
|
+
import { r as privateKey, t as expirationDate } from "../../flags-BSM3ANoc.js";
|
|
3
3
|
import { Command, Flags } from "@oclif/core";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
//#region src/commands/ca/sign.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as unsignedCa } from "../../content-attestation-
|
|
2
|
-
import { t as expirationDate } from "../../flags-
|
|
1
|
+
import { r as unsignedCa } from "../../content-attestation-Dd-YcVIv.js";
|
|
2
|
+
import { t as expirationDate } from "../../flags-BSM3ANoc.js";
|
|
3
3
|
import { Command, Flags } from "@oclif/core";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
//#region src/commands/ca/unsigned.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as opId, r as privateKey, t as expirationDate } from "../flags-
|
|
1
|
+
import { n as opId, r as privateKey, t as expirationDate } from "../flags-BSM3ANoc.js";
|
|
2
2
|
import { fetchAndSetDigestSri } from "@originator-profile/sign";
|
|
3
3
|
import { addYears } from "date-fns";
|
|
4
4
|
import { Command, Flags } from "@oclif/core";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/wsp/sign.d.ts
|
|
5
|
+
declare class WspSign extends Command {
|
|
6
|
+
static summary: string;
|
|
7
|
+
static description: string;
|
|
8
|
+
static flags: {
|
|
9
|
+
identity: _$_oclif_core_interfaces0.OptionFlag<{
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
kty: string;
|
|
12
|
+
kid: string;
|
|
13
|
+
use?: string | undefined;
|
|
14
|
+
key_ops?: string[] | undefined;
|
|
15
|
+
alg?: string | undefined;
|
|
16
|
+
x5u?: string | undefined;
|
|
17
|
+
x5c?: string[] | undefined;
|
|
18
|
+
x5t?: string | undefined;
|
|
19
|
+
"x5t#S256"?: string | undefined;
|
|
20
|
+
}, _$_oclif_core_interfaces0.CustomOptions>;
|
|
21
|
+
input: _$_oclif_core_interfaces0.OptionFlag<string, _$_oclif_core_interfaces0.CustomOptions>;
|
|
22
|
+
"issued-at": _$_oclif_core_interfaces0.OptionFlag<string | undefined, _$_oclif_core_interfaces0.CustomOptions>;
|
|
23
|
+
"expired-at": _$_oclif_core_interfaces0.OptionFlag<Date | undefined, _$_oclif_core_interfaces0.CustomOptions>;
|
|
24
|
+
};
|
|
25
|
+
static examples: string[];
|
|
26
|
+
run(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { WspSign };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { t as sign } from "../../website-profile-Brt0iuRN.js";
|
|
2
|
+
import { r as privateKey, t as expirationDate } from "../../flags-BSM3ANoc.js";
|
|
3
|
+
import { Command, Flags } from "@oclif/core";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
//#region src/commands/wsp/sign.ts
|
|
6
|
+
const exampleWebsiteProfile = {
|
|
7
|
+
"@context": [
|
|
8
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
9
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
10
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
11
|
+
{ "@language": "ja" }
|
|
12
|
+
],
|
|
13
|
+
type: ["VerifiableCredential", "WebsiteProfile"],
|
|
14
|
+
issuer: "dns:example.com",
|
|
15
|
+
credentialSubject: {
|
|
16
|
+
id: "https://media.example.com/",
|
|
17
|
+
type: "WebSite",
|
|
18
|
+
name: "<Webサイトのタイトル>",
|
|
19
|
+
description: "<Webサイトの説明>",
|
|
20
|
+
image: {
|
|
21
|
+
id: "https://media.example.com/image.png",
|
|
22
|
+
digestSRI: "sha256-Upwn7gYMuRmJlD1ZivHk876vXHzokXrwXj50VgfnMnY="
|
|
23
|
+
},
|
|
24
|
+
allowedOrigin: ["https://media.example.com"]
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const exampleMultilingualWebsiteProfile = [exampleWebsiteProfile, {
|
|
28
|
+
...exampleWebsiteProfile,
|
|
29
|
+
"@context": [
|
|
30
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
31
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
32
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
33
|
+
{ "@language": "en" }
|
|
34
|
+
],
|
|
35
|
+
credentialSubject: {
|
|
36
|
+
...exampleWebsiteProfile.credentialSubject,
|
|
37
|
+
name: "<Website title>",
|
|
38
|
+
description: "<Website description>"
|
|
39
|
+
}
|
|
40
|
+
}];
|
|
41
|
+
var WspSign = class WspSign extends Command {
|
|
42
|
+
static summary = "Website Profile の作成";
|
|
43
|
+
static description = `\
|
|
44
|
+
Website Profile に署名します。
|
|
45
|
+
入力が単一オブジェクトの場合は JWT を、配列の場合は JWT の配列を標準出力に出力します。
|
|
46
|
+
配列入力時は全要素が同一の issuer / credentialSubject.id を持ち、
|
|
47
|
+
@context の @language がそれぞれ異なる必要があります。`;
|
|
48
|
+
static flags = {
|
|
49
|
+
identity: privateKey({ required: true }),
|
|
50
|
+
input: Flags.string({
|
|
51
|
+
summary: "入力ファイルのパス (JSON 形式)",
|
|
52
|
+
helpValue: "<filepath>",
|
|
53
|
+
description: `\
|
|
54
|
+
Website Profile (WSP) の例:
|
|
55
|
+
|
|
56
|
+
${JSON.stringify(exampleWebsiteProfile, null, " ")}
|
|
57
|
+
|
|
58
|
+
多言語 Website Profile (配列) の例:
|
|
59
|
+
|
|
60
|
+
${JSON.stringify(exampleMultilingualWebsiteProfile, null, " ")}`,
|
|
61
|
+
required: true
|
|
62
|
+
}),
|
|
63
|
+
"issued-at": Flags.string({ description: "発行日時 (ISO 8601)" }),
|
|
64
|
+
"expired-at": expirationDate()
|
|
65
|
+
};
|
|
66
|
+
static examples = [`\
|
|
67
|
+
$ <%= config.bin %> <%= command.id %> \\
|
|
68
|
+
-i account-key.example.priv.json \\
|
|
69
|
+
--input website-profile.example.json`, `\
|
|
70
|
+
$ <%= config.bin %> <%= command.id %> \\
|
|
71
|
+
-i account-key.example.priv.json \\
|
|
72
|
+
--input website-profile.multilingual.example.json`];
|
|
73
|
+
async run() {
|
|
74
|
+
const { flags } = await this.parse(WspSign);
|
|
75
|
+
const inputBuffer = await fs.readFile(flags.input);
|
|
76
|
+
const input = JSON.parse(inputBuffer.toString());
|
|
77
|
+
if (Array.isArray(input)) {
|
|
78
|
+
const result = await sign(input, flags.identity, {
|
|
79
|
+
issuedAt: flags["issued-at"],
|
|
80
|
+
expiredAt: flags["expired-at"]
|
|
81
|
+
});
|
|
82
|
+
this.logJson(result);
|
|
83
|
+
} else {
|
|
84
|
+
const jwt = await sign(input, flags.identity, {
|
|
85
|
+
issuedAt: flags["issued-at"],
|
|
86
|
+
expiredAt: flags["expired-at"]
|
|
87
|
+
});
|
|
88
|
+
this.log(jwt);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { WspSign };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as expirationDate } from "../../flags-
|
|
1
|
+
import { n as unsignedWsp } from "../../website-profile-Brt0iuRN.js";
|
|
2
|
+
import { t as expirationDate } from "../../flags-BSM3ANoc.js";
|
|
3
3
|
import { Command, Flags } from "@oclif/core";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
//#region src/commands/wsp/unsigned.ts
|
|
@@ -24,6 +24,23 @@ const exampleWebsiteProfile = {
|
|
|
24
24
|
allowedOrigin: ["<Web サイトのオリジン (形式: https://<ホスト名>)>"]
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
const exampleMultilingualWebsiteProfile = [{
|
|
28
|
+
...exampleWebsiteProfile,
|
|
29
|
+
"@context": [
|
|
30
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
31
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
32
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
33
|
+
{ "@language": "ja" }
|
|
34
|
+
]
|
|
35
|
+
}, {
|
|
36
|
+
...exampleWebsiteProfile,
|
|
37
|
+
"@context": [
|
|
38
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
39
|
+
"https://originator-profile.org/ns/credentials/v1",
|
|
40
|
+
"https://originator-profile.org/ns/cip/v1",
|
|
41
|
+
{ "@language": "en" }
|
|
42
|
+
]
|
|
43
|
+
}];
|
|
27
44
|
var WspUnsigned = class WspUnsigned extends Command {
|
|
28
45
|
static summary = "未署名 Website Profile の取得";
|
|
29
46
|
static description = "標準出力に未署名 Website Profile を出力します。";
|
|
@@ -34,7 +51,11 @@ var WspUnsigned = class WspUnsigned extends Command {
|
|
|
34
51
|
description: `\
|
|
35
52
|
Website Profile の例:
|
|
36
53
|
|
|
37
|
-
${JSON.stringify(exampleWebsiteProfile, null, " ")}
|
|
54
|
+
${JSON.stringify(exampleWebsiteProfile, null, " ")}
|
|
55
|
+
|
|
56
|
+
多言語の Website Profile (配列) の例:
|
|
57
|
+
|
|
58
|
+
${JSON.stringify(exampleMultilingualWebsiteProfile, null, " ")}`,
|
|
38
59
|
required: true
|
|
39
60
|
}),
|
|
40
61
|
"issued-at": Flags.string({ description: "発行日時 (ISO 8601)" }),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
1
|
+
import { t as __exportAll } from "./chunk-pbuEa-1d.js";
|
|
2
|
+
import { t as parseDates } from "./timing-options-BWzawYM4.js";
|
|
2
3
|
import { JSDOM } from "jsdom";
|
|
3
|
-
import { parseExpirationDate } from "@originator-profile/core";
|
|
4
4
|
import { UnsignedContentAttestation } from "@originator-profile/model";
|
|
5
5
|
import { fetchAndSetDigestSri, fetchAndSetTargetIntegrity, signCa } from "@originator-profile/sign";
|
|
6
|
-
import {
|
|
6
|
+
import { getUnixTime } from "date-fns";
|
|
7
7
|
import { BadRequestError } from "http-errors-enhanced";
|
|
8
8
|
//#region src/document-provider.ts
|
|
9
9
|
async function documentProvider({ type, content = "" }) {
|
|
@@ -28,19 +28,6 @@ var content_attestation_exports = /* @__PURE__ */ __exportAll({
|
|
|
28
28
|
signByServer: () => signByServer,
|
|
29
29
|
unsignedCa: () => unsignedCa
|
|
30
30
|
});
|
|
31
|
-
function assertValidDate(value, fieldName) {
|
|
32
|
-
if (Number.isNaN(value.getTime())) throw new BadRequestError(`${fieldName} must be a valid date.`);
|
|
33
|
-
}
|
|
34
|
-
function parseDates({ issuedAt: issuedAtDateOrString = /* @__PURE__ */ new Date(), expiredAt: expiredAtDateOrString = addYears(/* @__PURE__ */ new Date(), 1) }) {
|
|
35
|
-
const issuedAt = new Date(issuedAtDateOrString);
|
|
36
|
-
const expiredAt = typeof expiredAtDateOrString === "string" ? parseExpirationDate(expiredAtDateOrString) : new Date(expiredAtDateOrString);
|
|
37
|
-
assertValidDate(issuedAt, "issuedAt");
|
|
38
|
-
assertValidDate(expiredAt, "expiredAt");
|
|
39
|
-
return {
|
|
40
|
-
issuedAt,
|
|
41
|
-
expiredAt
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
31
|
/**
|
|
45
32
|
* 未署名 Content Attestation の取得
|
|
46
33
|
* @param uca 未署名 Content Attestation オブジェクト
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Jwk, RawTarget, UnsignedContentAttestation, UnsignedWebsiteProfile } from "@originator-profile/model";
|
|
2
|
-
import { DocumentProvider } from "@originator-profile/sign";
|
|
1
|
+
import { Jwk, RawTarget, UnsignedContentAttestation, UnsignedWebsiteProfile, UnsignedWebsiteProfileSet } from "@originator-profile/model";
|
|
2
|
+
import { DocumentProvider, UnsignedWebsiteProfileInput } from "@originator-profile/sign";
|
|
3
3
|
|
|
4
4
|
//#region src/document-provider.d.ts
|
|
5
5
|
declare function documentProvider$1({
|
|
@@ -18,14 +18,16 @@ type HashAlgorithm = "sha256" | "sha384" | "sha512";
|
|
|
18
18
|
* representations for cryptographic operations. These algorithms are referenced by name when
|
|
19
19
|
* working with hashing functions in Web Crypto APIs.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type ContentAttestationTimingOptions = {
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/timing-options.d.ts
|
|
23
|
+
type TimingOptions = {
|
|
25
24
|
issuedAt?: Date | string;
|
|
26
25
|
expiredAt?: Date | string;
|
|
27
26
|
};
|
|
28
|
-
|
|
27
|
+
declare namespace content_attestation_d_exports {
|
|
28
|
+
export { sign$1 as sign, signByServer, unsignedCa };
|
|
29
|
+
}
|
|
30
|
+
type UnsignedCaOptions = TimingOptions & {
|
|
29
31
|
integrityAlg?: HashAlgorithm;
|
|
30
32
|
documentProvider?: DocumentProvider;
|
|
31
33
|
};
|
|
@@ -47,7 +49,7 @@ declare function unsignedCa(uca: UnsignedContentAttestation, {
|
|
|
47
49
|
* @throws {BadRequestError} 入力が UnsignedContentAttestation スキーマに適合しない場合/検証対象のコンテンツが存在しない/コンテンツにアクセスできない/Integrityの計算に失敗
|
|
48
50
|
* @return Content Attestation
|
|
49
51
|
*/
|
|
50
|
-
declare function sign(uca: UnsignedContentAttestation, privateKey: Jwk, options?:
|
|
52
|
+
declare function sign$1(uca: UnsignedContentAttestation, privateKey: Jwk, options?: TimingOptions): Promise<string>;
|
|
51
53
|
/**
|
|
52
54
|
* CA server 経由で Content Attestation を作成
|
|
53
55
|
* @param uca 未署名 Content Attestation オブジェクト
|
|
@@ -65,20 +67,29 @@ declare function signByServer(uca: UnsignedContentAttestation, {
|
|
|
65
67
|
accessToken: string;
|
|
66
68
|
}): Promise<string>;
|
|
67
69
|
declare namespace website_profile_d_exports {
|
|
68
|
-
export { unsignedWsp };
|
|
70
|
+
export { sign, unsignedWsp };
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* 未署名 Website Profile の取得
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
74
|
+
*
|
|
75
|
+
* 配列を渡した場合、全要素が同一の `issuer` と `credentialSubject.id` を持ち、
|
|
76
|
+
* `@context` の `@language` がそれぞれ異なることを検証します。
|
|
77
|
+
*
|
|
78
|
+
* @param uwsp 未署名 Website Profile オブジェクト (単一または配列)
|
|
79
|
+
* @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
|
|
80
|
+
* @return 未署名 Website Profile (配列入力時は配列)
|
|
75
81
|
*/
|
|
76
|
-
declare function unsignedWsp(uwsp:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
declare function unsignedWsp<U extends UnsignedWebsiteProfileInput>(uwsp: U, options: TimingOptions): Promise<U extends unknown[] ? UnsignedWebsiteProfileSet : UnsignedWebsiteProfile>;
|
|
83
|
+
/**
|
|
84
|
+
* Website Profile への署名
|
|
85
|
+
*
|
|
86
|
+
* 配列を渡した場合、各要素を個別に署名して JWT 文字列の配列を返します。
|
|
87
|
+
*
|
|
88
|
+
* @param uwsp 未署名 Website Profile (単一または配列)
|
|
89
|
+
* @param privateKey プライベート鍵
|
|
90
|
+
* @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
|
|
91
|
+
* @return 単一入力時は JWT 文字列、配列入力時は JWT 文字列の配列
|
|
92
|
+
*/
|
|
93
|
+
declare function sign<U extends UnsignedWebsiteProfileInput>(uwsp: U, privateKey: Jwk, options?: TimingOptions): Promise<U extends unknown[] ? string[] : string>;
|
|
83
94
|
//#endregion
|
|
84
95
|
export { content_attestation_d_exports as ContentAttestation, website_profile_d_exports as WebsiteProfile, documentProvider$1 as documentProvider };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as documentProvider, t as content_attestation_exports } from "./content-attestation-
|
|
2
|
-
import {
|
|
1
|
+
import { i as documentProvider, t as content_attestation_exports } from "./content-attestation-Dd-YcVIv.js";
|
|
2
|
+
import { r as website_profile_exports } from "./website-profile-Brt0iuRN.js";
|
|
3
3
|
export { content_attestation_exports as ContentAttestation, website_profile_exports as WebsiteProfile, documentProvider };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { addYears } from "date-fns";
|
|
2
|
+
import { BadRequestError } from "http-errors-enhanced";
|
|
3
|
+
import { parseExpirationDate } from "@originator-profile/core";
|
|
4
|
+
//#region src/timing-options.ts
|
|
5
|
+
function assertValidDate(value, fieldName) {
|
|
6
|
+
if (Number.isNaN(value.getTime())) throw new BadRequestError(`${fieldName} must be a valid date.`);
|
|
7
|
+
}
|
|
8
|
+
function parseDates({ issuedAt: issuedAtDateOrString = /* @__PURE__ */ new Date(), expiredAt: expiredAtDateOrString = addYears(/* @__PURE__ */ new Date(), 1) }) {
|
|
9
|
+
const issuedAt = new Date(issuedAtDateOrString);
|
|
10
|
+
const expiredAt = typeof expiredAtDateOrString === "string" ? parseExpirationDate(expiredAtDateOrString) : new Date(expiredAtDateOrString);
|
|
11
|
+
assertValidDate(issuedAt, "issuedAt");
|
|
12
|
+
assertValidDate(expiredAt, "expiredAt");
|
|
13
|
+
return {
|
|
14
|
+
issuedAt,
|
|
15
|
+
expiredAt
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { parseDates as t };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-pbuEa-1d.js";
|
|
2
|
+
import { t as parseDates } from "./timing-options-BWzawYM4.js";
|
|
3
|
+
import { UnsignedWebsiteProfileInput, fetchAndSetDigestSri, signWsp } from "@originator-profile/sign";
|
|
4
|
+
import { getUnixTime } from "date-fns";
|
|
5
|
+
import { BadRequestError } from "http-errors-enhanced";
|
|
6
|
+
//#region src/website-profile.ts
|
|
7
|
+
var website_profile_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
sign: () => sign,
|
|
9
|
+
unsignedWsp: () => unsignedWsp
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* 未署名 Website Profile の取得
|
|
13
|
+
*
|
|
14
|
+
* 配列を渡した場合、全要素が同一の `issuer` と `credentialSubject.id` を持ち、
|
|
15
|
+
* `@context` の `@language` がそれぞれ異なることを検証します。
|
|
16
|
+
*
|
|
17
|
+
* @param uwsp 未署名 Website Profile オブジェクト (単一または配列)
|
|
18
|
+
* @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
|
|
19
|
+
* @return 未署名 Website Profile (配列入力時は配列)
|
|
20
|
+
*/
|
|
21
|
+
async function unsignedWsp(uwsp, options) {
|
|
22
|
+
const timing = parseDates(options);
|
|
23
|
+
async function build(u) {
|
|
24
|
+
await fetchAndSetDigestSri("sha256", u.credentialSubject.image);
|
|
25
|
+
return {
|
|
26
|
+
...u,
|
|
27
|
+
iss: u.issuer,
|
|
28
|
+
sub: u.credentialSubject.id,
|
|
29
|
+
iat: getUnixTime(timing.issuedAt),
|
|
30
|
+
exp: getUnixTime(timing.expiredAt)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
UnsignedWebsiteProfileInput.parse(uwsp);
|
|
35
|
+
if (Array.isArray(uwsp)) return await Promise.all(uwsp.map(build));
|
|
36
|
+
return await build(uwsp);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new BadRequestError(e.message, { cause: e });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Website Profile への署名
|
|
43
|
+
*
|
|
44
|
+
* 配列を渡した場合、各要素を個別に署名して JWT 文字列の配列を返します。
|
|
45
|
+
*
|
|
46
|
+
* @param uwsp 未署名 Website Profile (単一または配列)
|
|
47
|
+
* @param privateKey プライベート鍵
|
|
48
|
+
* @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
|
|
49
|
+
* @return 単一入力時は JWT 文字列、配列入力時は JWT 文字列の配列
|
|
50
|
+
*/
|
|
51
|
+
async function sign(uwsp, privateKey, options = {}) {
|
|
52
|
+
const timing = parseDates(options);
|
|
53
|
+
try {
|
|
54
|
+
return await signWsp(uwsp, privateKey, timing);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
throw new BadRequestError(e.message, { cause: e });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { unsignedWsp as n, website_profile_exports as r, sign as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@originator-profile/opvc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-beta.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://docs.originator-profile.org",
|
|
6
6
|
"repository": {
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
"LICENSE",
|
|
20
20
|
"NOTICE"
|
|
21
21
|
],
|
|
22
|
-
"bin": "bin/run.js",
|
|
23
22
|
"exports": {
|
|
24
|
-
"types": "./dist/index.d.
|
|
25
|
-
"default": "./dist/index.
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
26
25
|
},
|
|
27
26
|
"oclif": {
|
|
28
27
|
"bin": "opvc",
|
|
@@ -39,26 +38,29 @@
|
|
|
39
38
|
"http-errors-enhanced": "^4.0.2",
|
|
40
39
|
"jose": "^6.2.2",
|
|
41
40
|
"jsdom": "^29.0.1",
|
|
42
|
-
"@originator-profile/
|
|
43
|
-
"@originator-profile/model": "0.
|
|
44
|
-
"@originator-profile/
|
|
45
|
-
"@originator-profile/
|
|
46
|
-
"@originator-profile/
|
|
41
|
+
"@originator-profile/cryptography": "0.6.0-beta.1",
|
|
42
|
+
"@originator-profile/model": "0.6.0-beta.1",
|
|
43
|
+
"@originator-profile/core": "0.6.0-beta.1",
|
|
44
|
+
"@originator-profile/sign": "0.6.0-beta.1",
|
|
45
|
+
"@originator-profile/securing-mechanism": "0.6.0-beta.1"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@types/node": "
|
|
50
|
-
"eslint": "
|
|
51
|
-
"oclif": "
|
|
52
|
-
"tsdown": "
|
|
53
|
-
"typescript": "
|
|
54
|
-
"websri": "
|
|
55
|
-
"@originator-profile/tsconfig": "0.
|
|
56
|
-
"eslint-config-originator-profile": "0.
|
|
48
|
+
"@types/node": "25.6.0",
|
|
49
|
+
"eslint": "10.2.0",
|
|
50
|
+
"oclif": "4.23.0",
|
|
51
|
+
"tsdown": "0.21.7",
|
|
52
|
+
"typescript": "6.0.2",
|
|
53
|
+
"websri": "1.0.1",
|
|
54
|
+
"@originator-profile/tsconfig": "0.6.0-beta.1",
|
|
55
|
+
"eslint-config-originator-profile": "0.6.0-beta.1"
|
|
57
56
|
},
|
|
58
57
|
"scripts": {
|
|
59
58
|
"build": "tsdown && oclif manifest && oclif readme",
|
|
60
59
|
"lint": "eslint --fix .",
|
|
61
60
|
"type-check": "tsc",
|
|
62
|
-
"test": "node --
|
|
61
|
+
"test": "node --test"
|
|
62
|
+
},
|
|
63
|
+
"bin": {
|
|
64
|
+
"opvc": "bin/run.js"
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
|
|
2
|
-
import { parseExpirationDate } from "@originator-profile/core";
|
|
3
|
-
import { UnsignedWebsiteProfile } from "@originator-profile/model";
|
|
4
|
-
import { fetchAndSetDigestSri } from "@originator-profile/sign";
|
|
5
|
-
import { addYears, getUnixTime } from "date-fns";
|
|
6
|
-
//#region src/website-profile.ts
|
|
7
|
-
var website_profile_exports = /* @__PURE__ */ __exportAll({ unsignedWsp: () => unsignedWsp });
|
|
8
|
-
/**
|
|
9
|
-
* 未署名 Website Profile の取得
|
|
10
|
-
* @param uwsp 未署名 Website Profile オブジェクト
|
|
11
|
-
* @throws {Error} 入力が UnsignedWebsiteProfile スキーマに適合しない場合
|
|
12
|
-
* @return 未署名 Website Profile オブジェクト
|
|
13
|
-
*/
|
|
14
|
-
async function unsignedWsp(uwsp, { issuedAt: issuedAtDateOrString = /* @__PURE__ */ new Date(), expiredAt: expiredAtDateOrString = addYears(/* @__PURE__ */ new Date(), 1) }) {
|
|
15
|
-
UnsignedWebsiteProfile.parse(uwsp);
|
|
16
|
-
const issuedAt = new Date(issuedAtDateOrString);
|
|
17
|
-
const expiredAt = typeof expiredAtDateOrString === "string" ? parseExpirationDate(expiredAtDateOrString) : expiredAtDateOrString;
|
|
18
|
-
await fetchAndSetDigestSri("sha256", uwsp.credentialSubject.image);
|
|
19
|
-
return {
|
|
20
|
-
iss: uwsp.issuer,
|
|
21
|
-
sub: uwsp.credentialSubject.id,
|
|
22
|
-
iat: getUnixTime(issuedAt),
|
|
23
|
-
exp: getUnixTime(expiredAt),
|
|
24
|
-
...uwsp
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { website_profile_exports as n, unsignedWsp as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|