@icp-sdk/core 5.0.0-beta.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/agent/actor.d.ts +15 -1
- package/lib/cjs/agent/actor.d.ts.map +1 -1
- package/lib/cjs/agent/actor.js +37 -91
- package/lib/cjs/agent/actor.js.map +1 -1
- package/lib/cjs/agent/agent/api.d.ts +29 -6
- package/lib/cjs/agent/agent/api.d.ts.map +1 -1
- package/lib/cjs/agent/agent/api.js.map +1 -1
- package/lib/cjs/agent/agent/http/expiry.d.ts +36 -0
- package/lib/cjs/agent/agent/http/expiry.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/expiry.js +92 -0
- package/lib/cjs/agent/agent/http/expiry.js.map +1 -0
- package/lib/cjs/agent/agent/http/index.d.ts +11 -2
- package/lib/cjs/agent/agent/http/index.d.ts.map +1 -1
- package/lib/cjs/agent/agent/http/index.js +142 -73
- package/lib/cjs/agent/agent/http/index.js.map +1 -1
- package/lib/cjs/agent/agent/http/transforms.d.ts +1 -35
- package/lib/cjs/agent/agent/http/transforms.d.ts.map +1 -1
- package/lib/cjs/agent/agent/http/transforms.js +6 -90
- package/lib/cjs/agent/agent/http/transforms.js.map +1 -1
- package/lib/cjs/agent/agent/http/types.d.ts +1 -1
- package/lib/cjs/agent/agent/http/types.d.ts.map +1 -1
- package/lib/cjs/agent/auth.d.ts +1 -1
- package/lib/cjs/agent/auth.d.ts.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.d.ts +5 -4
- package/lib/cjs/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.js +6 -10
- package/lib/cjs/agent/canisterStatus/index.js.map +1 -1
- package/lib/cjs/agent/cbor.js +2 -2
- package/lib/cjs/agent/cbor.js.map +1 -1
- package/lib/cjs/agent/certificate.d.ts +4 -4
- package/lib/cjs/agent/certificate.d.ts.map +1 -1
- package/lib/cjs/agent/certificate.js +6 -10
- package/lib/cjs/agent/certificate.js.map +1 -1
- package/lib/cjs/agent/constants.d.ts +4 -4
- package/lib/cjs/agent/constants.d.ts.map +1 -1
- package/lib/cjs/agent/der.d.ts.map +1 -1
- package/lib/cjs/agent/der.js +26 -21
- package/lib/cjs/agent/der.js.map +1 -1
- package/lib/cjs/agent/errors.d.ts +27 -18
- package/lib/cjs/agent/errors.d.ts.map +1 -1
- package/lib/cjs/agent/errors.js +18 -15
- package/lib/cjs/agent/errors.js.map +1 -1
- package/lib/cjs/agent/observable.d.ts +1 -1
- package/lib/cjs/agent/observable.d.ts.map +1 -1
- package/lib/cjs/agent/polling/backoff.d.ts +7 -7
- package/lib/cjs/agent/polling/backoff.d.ts.map +1 -1
- package/lib/cjs/agent/polling/backoff.js +3 -5
- package/lib/cjs/agent/polling/backoff.js.map +1 -1
- package/lib/cjs/agent/polling/index.d.ts +11 -10
- package/lib/cjs/agent/polling/index.d.ts.map +1 -1
- package/lib/cjs/agent/polling/index.js +8 -6
- package/lib/cjs/agent/polling/index.js.map +1 -1
- package/lib/cjs/agent/polling/strategy.d.ts +2 -5
- package/lib/cjs/agent/polling/strategy.d.ts.map +1 -1
- package/lib/cjs/agent/polling/strategy.js.map +1 -1
- package/lib/cjs/agent/polling/types.d.ts +18 -0
- package/lib/cjs/agent/polling/types.d.ts.map +1 -0
- package/lib/cjs/agent/polling/types.js +3 -0
- package/lib/cjs/agent/polling/types.js.map +1 -0
- package/lib/cjs/agent/public_key.d.ts +1 -1
- package/lib/cjs/agent/public_key.d.ts.map +1 -1
- package/lib/cjs/agent/request_id.d.ts.map +1 -1
- package/lib/cjs/agent/request_id.js +7 -7
- package/lib/cjs/agent/request_id.js.map +1 -1
- package/lib/cjs/agent/subnetStatus/index.d.ts +5 -4
- package/lib/cjs/agent/subnetStatus/index.d.ts.map +1 -1
- package/lib/cjs/agent/subnetStatus/index.js +6 -10
- package/lib/cjs/agent/subnetStatus/index.js.map +1 -1
- package/lib/cjs/agent/utils/buffer.d.ts.map +1 -1
- package/lib/cjs/agent/utils/buffer.js +4 -2
- package/lib/cjs/agent/utils/buffer.js.map +1 -1
- package/lib/cjs/agent/utils/certificateReject.d.ts +11 -0
- package/lib/cjs/agent/utils/certificateReject.d.ts.map +1 -0
- package/lib/cjs/agent/utils/certificateReject.js +19 -0
- package/lib/cjs/agent/utils/certificateReject.js.map +1 -0
- package/lib/cjs/agent/utils/expirableMap.d.ts +4 -4
- package/lib/cjs/agent/utils/expirableMap.d.ts.map +1 -1
- package/lib/cjs/agent/utils/expirableMap.js +2 -2
- package/lib/cjs/agent/utils/readState.d.ts +3 -3
- package/lib/cjs/agent/utils/readState.d.ts.map +1 -1
- package/lib/cjs/candid/candid-core.d.ts +1 -1
- package/lib/cjs/candid/candid-core.d.ts.map +1 -1
- package/lib/cjs/candid/candid-core.js +7 -9
- package/lib/cjs/candid/candid-core.js.map +1 -1
- package/lib/cjs/candid/candid-ui.d.ts.map +1 -1
- package/lib/cjs/candid/candid-ui.js +8 -24
- package/lib/cjs/candid/candid-ui.js.map +1 -1
- package/lib/cjs/candid/idl.d.ts +14 -1
- package/lib/cjs/candid/idl.d.ts.map +1 -1
- package/lib/cjs/candid/idl.js +164 -125
- package/lib/cjs/candid/idl.js.map +1 -1
- package/lib/cjs/candid/utils/leb128.d.ts.map +1 -1
- package/lib/cjs/candid/utils/leb128.js +1 -3
- package/lib/cjs/candid/utils/leb128.js.map +1 -1
- package/lib/cjs/identity/identity/delegation.d.ts +4 -3
- package/lib/cjs/identity/identity/delegation.d.ts.map +1 -1
- package/lib/cjs/identity/identity/delegation.js +3 -3
- package/lib/cjs/identity/identity/delegation.js.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.d.ts +2 -2
- package/lib/cjs/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.js +2 -4
- package/lib/cjs/identity/identity/ecdsa.js.map +1 -1
- package/lib/cjs/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ed25519.js +9 -10
- package/lib/cjs/identity/identity/ed25519.js.map +1 -1
- package/lib/cjs/identity/identity/partial.d.ts +1 -1
- package/lib/cjs/identity/identity/partial.d.ts.map +1 -1
- package/lib/cjs/identity/identity/webauthn.js +4 -5
- package/lib/cjs/identity/identity/webauthn.js.map +1 -1
- package/lib/cjs/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/der.js +27 -22
- package/lib/cjs/identity/secp256k1/der.js.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.js +1 -1
- package/lib/cjs/identity/secp256k1/pem.js.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.js +6 -6
- package/lib/cjs/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/cjs/principal/principal.d.ts +2 -2
- package/lib/cjs/principal/principal.d.ts.map +1 -1
- package/lib/cjs/principal/principal.js +10 -6
- package/lib/cjs/principal/principal.js.map +1 -1
- package/lib/esm/agent/actor.d.ts +15 -1
- package/lib/esm/agent/actor.d.ts.map +1 -1
- package/lib/esm/agent/actor.js +40 -94
- package/lib/esm/agent/actor.js.map +1 -1
- package/lib/esm/agent/agent/api.d.ts +29 -6
- package/lib/esm/agent/agent/api.d.ts.map +1 -1
- package/lib/esm/agent/agent/api.js.map +1 -1
- package/lib/esm/agent/agent/http/expiry.d.ts +36 -0
- package/lib/esm/agent/agent/http/expiry.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/expiry.js +88 -0
- package/lib/esm/agent/agent/http/expiry.js.map +1 -0
- package/lib/esm/agent/agent/http/index.d.ts +11 -2
- package/lib/esm/agent/agent/http/index.d.ts.map +1 -1
- package/lib/esm/agent/agent/http/index.js +145 -76
- package/lib/esm/agent/agent/http/index.js.map +1 -1
- package/lib/esm/agent/agent/http/transforms.d.ts +1 -35
- package/lib/esm/agent/agent/http/transforms.d.ts.map +1 -1
- package/lib/esm/agent/agent/http/transforms.js +2 -87
- package/lib/esm/agent/agent/http/transforms.js.map +1 -1
- package/lib/esm/agent/agent/http/types.d.ts +1 -1
- package/lib/esm/agent/agent/http/types.d.ts.map +1 -1
- package/lib/esm/agent/auth.d.ts +1 -1
- package/lib/esm/agent/auth.d.ts.map +1 -1
- package/lib/esm/agent/canister-env/index.d.ts +2 -2
- package/lib/esm/agent/canister-env/index.d.ts.map +1 -1
- package/lib/esm/agent/canisterStatus/index.d.ts +5 -4
- package/lib/esm/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/esm/agent/canisterStatus/index.js +6 -10
- package/lib/esm/agent/canisterStatus/index.js.map +1 -1
- package/lib/esm/agent/cbor.js +1 -1
- package/lib/esm/agent/cbor.js.map +1 -1
- package/lib/esm/agent/certificate.d.ts +4 -4
- package/lib/esm/agent/certificate.d.ts.map +1 -1
- package/lib/esm/agent/certificate.js +6 -10
- package/lib/esm/agent/certificate.js.map +1 -1
- package/lib/esm/agent/constants.d.ts +4 -4
- package/lib/esm/agent/constants.d.ts.map +1 -1
- package/lib/esm/agent/der.d.ts.map +1 -1
- package/lib/esm/agent/der.js +26 -21
- package/lib/esm/agent/der.js.map +1 -1
- package/lib/esm/agent/errors.d.ts +27 -18
- package/lib/esm/agent/errors.d.ts.map +1 -1
- package/lib/esm/agent/errors.js +16 -13
- package/lib/esm/agent/errors.js.map +1 -1
- package/lib/esm/agent/observable.d.ts +1 -1
- package/lib/esm/agent/observable.d.ts.map +1 -1
- package/lib/esm/agent/polling/backoff.d.ts +7 -7
- package/lib/esm/agent/polling/backoff.d.ts.map +1 -1
- package/lib/esm/agent/polling/backoff.js +3 -5
- package/lib/esm/agent/polling/backoff.js.map +1 -1
- package/lib/esm/agent/polling/index.d.ts +11 -10
- package/lib/esm/agent/polling/index.d.ts.map +1 -1
- package/lib/esm/agent/polling/index.js +9 -7
- package/lib/esm/agent/polling/index.js.map +1 -1
- package/lib/esm/agent/polling/strategy.d.ts +2 -5
- package/lib/esm/agent/polling/strategy.d.ts.map +1 -1
- package/lib/esm/agent/polling/strategy.js.map +1 -1
- package/lib/esm/agent/polling/types.d.ts +18 -0
- package/lib/esm/agent/polling/types.d.ts.map +1 -0
- package/lib/esm/agent/polling/types.js +2 -0
- package/lib/esm/agent/polling/types.js.map +1 -0
- package/lib/esm/agent/public_key.d.ts +1 -1
- package/lib/esm/agent/public_key.d.ts.map +1 -1
- package/lib/esm/agent/request_id.d.ts.map +1 -1
- package/lib/esm/agent/request_id.js +7 -7
- package/lib/esm/agent/request_id.js.map +1 -1
- package/lib/esm/agent/subnetStatus/index.d.ts +5 -4
- package/lib/esm/agent/subnetStatus/index.d.ts.map +1 -1
- package/lib/esm/agent/subnetStatus/index.js +6 -10
- package/lib/esm/agent/subnetStatus/index.js.map +1 -1
- package/lib/esm/agent/utils/buffer.d.ts.map +1 -1
- package/lib/esm/agent/utils/buffer.js +4 -2
- package/lib/esm/agent/utils/buffer.js.map +1 -1
- package/lib/esm/agent/utils/certificateReject.d.ts +11 -0
- package/lib/esm/agent/utils/certificateReject.d.ts.map +1 -0
- package/lib/esm/agent/utils/certificateReject.js +16 -0
- package/lib/esm/agent/utils/certificateReject.js.map +1 -0
- package/lib/esm/agent/utils/expirableMap.d.ts +4 -4
- package/lib/esm/agent/utils/expirableMap.d.ts.map +1 -1
- package/lib/esm/agent/utils/expirableMap.js +2 -2
- package/lib/esm/agent/utils/readState.d.ts +3 -3
- package/lib/esm/agent/utils/readState.d.ts.map +1 -1
- package/lib/esm/candid/candid-core.d.ts +1 -1
- package/lib/esm/candid/candid-core.d.ts.map +1 -1
- package/lib/esm/candid/candid-core.js +7 -9
- package/lib/esm/candid/candid-core.js.map +1 -1
- package/lib/esm/candid/candid-ui.d.ts.map +1 -1
- package/lib/esm/candid/candid-ui.js +7 -23
- package/lib/esm/candid/candid-ui.js.map +1 -1
- package/lib/esm/candid/idl.d.ts +14 -1
- package/lib/esm/candid/idl.d.ts.map +1 -1
- package/lib/esm/candid/idl.js +162 -124
- package/lib/esm/candid/idl.js.map +1 -1
- package/lib/esm/candid/utils/leb128.d.ts.map +1 -1
- package/lib/esm/candid/utils/leb128.js +1 -3
- package/lib/esm/candid/utils/leb128.js.map +1 -1
- package/lib/esm/identity/identity/delegation.d.ts +4 -3
- package/lib/esm/identity/identity/delegation.d.ts.map +1 -1
- package/lib/esm/identity/identity/delegation.js +3 -3
- package/lib/esm/identity/identity/delegation.js.map +1 -1
- package/lib/esm/identity/identity/ecdsa.d.ts +2 -2
- package/lib/esm/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/esm/identity/identity/ecdsa.js +2 -4
- package/lib/esm/identity/identity/ecdsa.js.map +1 -1
- package/lib/esm/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/esm/identity/identity/ed25519.js +9 -10
- package/lib/esm/identity/identity/ed25519.js.map +1 -1
- package/lib/esm/identity/identity/partial.d.ts +1 -1
- package/lib/esm/identity/identity/partial.d.ts.map +1 -1
- package/lib/esm/identity/identity/webauthn.js +4 -5
- package/lib/esm/identity/identity/webauthn.js.map +1 -1
- package/lib/esm/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/der.js +27 -22
- package/lib/esm/identity/secp256k1/der.js.map +1 -1
- package/lib/esm/identity/secp256k1/pem.js +1 -1
- package/lib/esm/identity/secp256k1/pem.js.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.js +6 -6
- package/lib/esm/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/esm/principal/principal.d.ts +2 -2
- package/lib/esm/principal/principal.d.ts.map +1 -1
- package/lib/esm/principal/principal.js +10 -6
- package/lib/esm/principal/principal.js.map +1 -1
- package/package.json +13 -13
- package/src/agent/actor.ts +74 -126
- package/src/agent/agent/api.ts +36 -6
- package/src/agent/agent/http/expiry.ts +107 -0
- package/src/agent/agent/http/index.ts +217 -90
- package/src/agent/agent/http/transforms.ts +2 -106
- package/src/agent/agent/http/types.ts +1 -1
- package/src/agent/auth.ts +1 -1
- package/src/agent/canister-env/index.ts +2 -2
- package/src/agent/canisterStatus/index.ts +10 -12
- package/src/agent/cbor.ts +1 -1
- package/src/agent/certificate.ts +11 -13
- package/src/agent/der.ts +40 -19
- package/src/agent/errors.ts +41 -31
- package/src/agent/fetch_candid.ts +1 -1
- package/src/agent/observable.ts +1 -1
- package/src/agent/polling/backoff.ts +9 -10
- package/src/agent/polling/index.ts +14 -26
- package/src/agent/polling/strategy.ts +5 -9
- package/src/agent/polling/types.ts +28 -0
- package/src/agent/public_key.ts +1 -1
- package/src/agent/request_id.ts +15 -8
- package/src/agent/subnetStatus/index.ts +10 -12
- package/src/agent/utils/buffer.ts +6 -2
- package/src/agent/utils/certificateReject.ts +25 -0
- package/src/agent/utils/expirableMap.ts +4 -4
- package/src/agent/utils/random.ts +2 -2
- package/src/agent/utils/readState.ts +3 -3
- package/src/candid/candid-core.ts +9 -11
- package/src/candid/candid-ui.ts +8 -16
- package/src/candid/idl.ts +210 -112
- package/src/candid/utils/leb128.ts +1 -2
- package/src/identity/identity/delegation.ts +5 -5
- package/src/identity/identity/ecdsa.ts +12 -8
- package/src/identity/identity/ed25519.ts +16 -9
- package/src/identity/identity/partial.ts +1 -1
- package/src/identity/identity/webauthn.ts +21 -21
- package/src/identity/secp256k1/der.ts +41 -20
- package/src/identity/secp256k1/pem.ts +1 -1
- package/src/identity/secp256k1/secp256k1.ts +12 -6
- package/src/principal/principal.ts +18 -8
- package/LICENSE +0 -201
|
@@ -120,9 +120,8 @@ export function slebEncode(value: bigint | number): Uint8Array {
|
|
|
120
120
|
if (isNeg) {
|
|
121
121
|
// We swap the bits here again, and remove 1 to do two's complement.
|
|
122
122
|
return Number(BigInt(0x80) - bytes - BigInt(1));
|
|
123
|
-
} else {
|
|
124
|
-
return Number(bytes);
|
|
125
123
|
}
|
|
124
|
+
return Number(bytes);
|
|
126
125
|
}
|
|
127
126
|
return pipe.buffer;
|
|
128
127
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToCborValue } from '#agent';
|
|
1
2
|
import {
|
|
2
3
|
type DerEncodedPublicKey,
|
|
3
4
|
type HttpAgentRequest,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
SignIdentity,
|
|
8
9
|
IC_REQUEST_DOMAIN_SEPARATOR,
|
|
9
10
|
IC_REQUEST_AUTH_DELEGATION_DOMAIN_SEPARATOR,
|
|
10
|
-
ToCborValue,
|
|
11
11
|
} from '#agent';
|
|
12
12
|
import { Principal } from '#principal';
|
|
13
13
|
import { PartialIdentity } from './partial.ts';
|
|
@@ -15,7 +15,7 @@ import { bytesToHex, hexToBytes } from '@noble/hashes/utils';
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Safe wrapper around bytesToHex that handles ArrayBuffer/Uint8Array type conversion.
|
|
18
|
-
* Required because
|
|
18
|
+
* Required because `@noble/hashes` v1.8+ strictly expects Uint8Array inputs.
|
|
19
19
|
* @param data The binary data to convert to hexadecimal string (ArrayBuffer, Uint8Array, or ArrayLike<number>)
|
|
20
20
|
*/
|
|
21
21
|
function safeBytesToHex(data: ArrayBuffer | Uint8Array | ArrayLike<number>): string {
|
|
@@ -37,7 +37,7 @@ function _parseBlob(value: unknown): Uint8Array {
|
|
|
37
37
|
* A single delegation object that is signed by a private key. This is constructed by
|
|
38
38
|
* `DelegationChain.create()`.
|
|
39
39
|
*
|
|
40
|
-
* {@
|
|
40
|
+
* {@link DelegationChain}
|
|
41
41
|
*/
|
|
42
42
|
export class Delegation implements ToCborValue {
|
|
43
43
|
constructor(
|
|
@@ -87,7 +87,7 @@ interface JsonnableDelegation {
|
|
|
87
87
|
* A signed delegation, which lends its identity to the public key in the delegation
|
|
88
88
|
* object. This is constructed by `DelegationChain.create()`.
|
|
89
89
|
*
|
|
90
|
-
* {@
|
|
90
|
+
* {@link DelegationChain}
|
|
91
91
|
*/
|
|
92
92
|
export interface SignedDelegation {
|
|
93
93
|
delegation: Delegation;
|
|
@@ -212,7 +212,7 @@ export class DelegationChain {
|
|
|
212
212
|
return {
|
|
213
213
|
delegation: new Delegation(
|
|
214
214
|
_parseBlob(pubkey),
|
|
215
|
-
BigInt(
|
|
215
|
+
BigInt(`0x${expiration}`), // expiration in JSON is an hexa string (See toJSON() below).
|
|
216
216
|
targets &&
|
|
217
217
|
targets.map((t: unknown) => {
|
|
218
218
|
if (typeof t !== 'string') {
|
|
@@ -4,11 +4,11 @@ import { uint8FromBufLike } from '#candid';
|
|
|
4
4
|
/**
|
|
5
5
|
* Options used in a {@link ECDSAKeyIdentity}
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export interface CryptoKeyOptions {
|
|
8
8
|
extractable?: boolean;
|
|
9
9
|
keyUsages?: KeyUsage[];
|
|
10
10
|
subtleCrypto?: SubtleCrypto;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export class CryptoError extends Error {
|
|
14
14
|
constructor(public readonly message: string) {
|
|
@@ -32,13 +32,13 @@ function _getEffectiveCrypto(subtleCrypto: CryptoKeyOptions['subtleCrypto']): Su
|
|
|
32
32
|
}
|
|
33
33
|
if (subtleCrypto) {
|
|
34
34
|
return subtleCrypto;
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
|
+
if (typeof crypto !== 'undefined' && crypto['subtle']) {
|
|
36
37
|
return crypto.subtle;
|
|
37
|
-
} else {
|
|
38
|
-
throw new CryptoError(
|
|
39
|
-
'Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto',
|
|
40
|
-
);
|
|
41
38
|
}
|
|
39
|
+
throw new CryptoError(
|
|
40
|
+
'Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto',
|
|
41
|
+
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -144,7 +144,11 @@ export class ECDSAKeyIdentity extends SignIdentity {
|
|
|
144
144
|
hash: { name: 'SHA-256' },
|
|
145
145
|
};
|
|
146
146
|
const signature = uint8FromBufLike(
|
|
147
|
-
await this._subtleCrypto.sign(
|
|
147
|
+
await this._subtleCrypto.sign(
|
|
148
|
+
params,
|
|
149
|
+
this._keyPair.privateKey,
|
|
150
|
+
challenge as Uint8Array<ArrayBuffer>,
|
|
151
|
+
),
|
|
148
152
|
);
|
|
149
153
|
|
|
150
154
|
Object.assign(signature, {
|
|
@@ -28,20 +28,26 @@ export class Ed25519PublicKey implements PublicKey {
|
|
|
28
28
|
if (typeof maybeKey === 'string') {
|
|
29
29
|
const key = hexToBytes(maybeKey);
|
|
30
30
|
return this.fromRaw(key);
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
|
+
if (isObject(maybeKey)) {
|
|
32
33
|
const key = maybeKey as KeyLike;
|
|
33
34
|
if (isObject(key) && Object.hasOwnProperty.call(key, '__derEncodedPublicKey__')) {
|
|
34
35
|
return this.fromDer(key as DerEncodedPublicKey);
|
|
35
|
-
}
|
|
36
|
+
}
|
|
37
|
+
if (ArrayBuffer.isView(key)) {
|
|
36
38
|
const view = key as ArrayBufferView;
|
|
37
39
|
return this.fromRaw(uint8FromBufLike(view.buffer));
|
|
38
|
-
}
|
|
40
|
+
}
|
|
41
|
+
if (key instanceof ArrayBuffer) {
|
|
39
42
|
return this.fromRaw(uint8FromBufLike(key));
|
|
40
|
-
}
|
|
43
|
+
}
|
|
44
|
+
if ('rawKey' in key && key.rawKey instanceof Uint8Array) {
|
|
41
45
|
return this.fromRaw(key.rawKey);
|
|
42
|
-
}
|
|
46
|
+
}
|
|
47
|
+
if ('derKey' in key) {
|
|
43
48
|
return this.fromDer(key.derKey as DerEncodedPublicKey);
|
|
44
|
-
}
|
|
49
|
+
}
|
|
50
|
+
if ('toDer' in key) {
|
|
45
51
|
return this.fromDer(key.toDer());
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -116,7 +122,9 @@ export class Ed25519KeyIdentity extends SignIdentity {
|
|
|
116
122
|
if (seed && seed.length !== 32) {
|
|
117
123
|
throw new Error('Ed25519 Seed needs to be 32 bytes long.');
|
|
118
124
|
}
|
|
119
|
-
if (!seed)
|
|
125
|
+
if (!seed) {
|
|
126
|
+
seed = ed25519.utils.randomPrivateKey();
|
|
127
|
+
}
|
|
120
128
|
// Check if the seed is all zeros
|
|
121
129
|
if (uint8Equals(seed, new Uint8Array(new Array(32).fill(0)))) {
|
|
122
130
|
console.warn(
|
|
@@ -145,9 +153,8 @@ export class Ed25519KeyIdentity extends SignIdentity {
|
|
|
145
153
|
if (Array.isArray(parsed)) {
|
|
146
154
|
if (typeof parsed[0] === 'string' && typeof parsed[1] === 'string') {
|
|
147
155
|
return this.fromParsedJson([parsed[0], parsed[1]]);
|
|
148
|
-
} else {
|
|
149
|
-
throw new Error('Deserialization error: JSON must have at least 2 items.');
|
|
150
156
|
}
|
|
157
|
+
throw new Error('Deserialization error: JSON must have at least 2 items.');
|
|
151
158
|
}
|
|
152
159
|
throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(json)}`);
|
|
153
160
|
}
|
|
@@ -71,9 +71,8 @@ export class CosePublicKey implements PublicKey {
|
|
|
71
71
|
function _createChallengeBuffer(challenge: string | Uint8Array = '<ic0.app>'): Uint8Array {
|
|
72
72
|
if (typeof challenge === 'string') {
|
|
73
73
|
return Uint8Array.from(challenge, c => c.charCodeAt(0));
|
|
74
|
-
} else {
|
|
75
|
-
return challenge;
|
|
76
74
|
}
|
|
75
|
+
return challenge;
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
/**
|
|
@@ -86,25 +85,26 @@ function _createChallengeBuffer(challenge: string | Uint8Array = '<ic0.app>'): U
|
|
|
86
85
|
async function _createCredential(
|
|
87
86
|
credentialCreationOptions?: CredentialCreationOptions,
|
|
88
87
|
): Promise<PublicKeyCredentialWithAttachment | null> {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
displayName: 'Internet Identity',
|
|
105
|
-
},
|
|
88
|
+
const defaultCredentialCreationOptions: CredentialCreationOptions = {
|
|
89
|
+
publicKey: {
|
|
90
|
+
authenticatorSelection: {
|
|
91
|
+
userVerification: 'preferred',
|
|
92
|
+
},
|
|
93
|
+
attestation: 'direct',
|
|
94
|
+
challenge: _createChallengeBuffer() as Uint8Array<ArrayBuffer>,
|
|
95
|
+
pubKeyCredParams: [{ type: 'public-key', alg: PubKeyCoseAlgo.ECDSA_WITH_SHA256 }],
|
|
96
|
+
rp: {
|
|
97
|
+
name: 'Internet Identity Service',
|
|
98
|
+
},
|
|
99
|
+
user: {
|
|
100
|
+
id: randomBytes(16) as Uint8Array<ArrayBuffer>,
|
|
101
|
+
name: 'Internet Identity',
|
|
102
|
+
displayName: 'Internet Identity',
|
|
106
103
|
},
|
|
107
104
|
},
|
|
105
|
+
};
|
|
106
|
+
const creds = (await navigator.credentials.create(
|
|
107
|
+
credentialCreationOptions ?? defaultCredentialCreationOptions,
|
|
108
108
|
)) as PublicKeyCredentialWithAttachment | null;
|
|
109
109
|
|
|
110
110
|
if (creds === null) {
|
|
@@ -212,10 +212,10 @@ export class WebAuthnIdentity extends SignIdentity {
|
|
|
212
212
|
allowCredentials: [
|
|
213
213
|
{
|
|
214
214
|
type: 'public-key',
|
|
215
|
-
id: this.rawId
|
|
215
|
+
id: this.rawId as Uint8Array<ArrayBuffer>,
|
|
216
216
|
},
|
|
217
217
|
],
|
|
218
|
-
challenge: blob
|
|
218
|
+
challenge: blob as Uint8Array<ArrayBuffer>,
|
|
219
219
|
userVerification: 'preferred',
|
|
220
220
|
},
|
|
221
221
|
})) as PublicKeyCredentialWithAttachment;
|
|
@@ -3,57 +3,78 @@ import { uint8Equals } from '#candid';
|
|
|
3
3
|
export const encodeLenBytes = (len: number): number => {
|
|
4
4
|
if (len <= 0x7f) {
|
|
5
5
|
return 1;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
if (len <= 0xff) {
|
|
7
8
|
return 2;
|
|
8
|
-
}
|
|
9
|
+
}
|
|
10
|
+
if (len <= 0xffff) {
|
|
9
11
|
return 3;
|
|
10
|
-
}
|
|
12
|
+
}
|
|
13
|
+
if (len <= 0xffffff) {
|
|
11
14
|
return 4;
|
|
12
|
-
} else {
|
|
13
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
14
15
|
}
|
|
16
|
+
throw new Error('Length too long (> 4 bytes)');
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export const encodeLen = (buf: Uint8Array, offset: number, len: number): number => {
|
|
18
20
|
if (len <= 0x7f) {
|
|
19
21
|
buf[offset] = len;
|
|
20
22
|
return 1;
|
|
21
|
-
}
|
|
23
|
+
}
|
|
24
|
+
if (len <= 0xff) {
|
|
22
25
|
buf[offset] = 0x81;
|
|
23
26
|
buf[offset + 1] = len;
|
|
24
27
|
return 2;
|
|
25
|
-
}
|
|
28
|
+
}
|
|
29
|
+
if (len <= 0xffff) {
|
|
26
30
|
buf[offset] = 0x82;
|
|
27
31
|
buf[offset + 1] = len >> 8;
|
|
28
32
|
buf[offset + 2] = len;
|
|
29
33
|
return 3;
|
|
30
|
-
}
|
|
34
|
+
}
|
|
35
|
+
if (len <= 0xffffff) {
|
|
31
36
|
buf[offset] = 0x83;
|
|
32
37
|
buf[offset + 1] = len >> 16;
|
|
33
38
|
buf[offset + 2] = len >> 8;
|
|
34
39
|
buf[offset + 3] = len;
|
|
35
40
|
return 4;
|
|
36
|
-
} else {
|
|
37
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
38
41
|
}
|
|
42
|
+
throw new Error('Length too long (> 4 bytes)');
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export const decodeLenBytes = (buf: Uint8Array, offset: number): number => {
|
|
42
|
-
if (buf[offset] < 0x80)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (buf[offset] ===
|
|
46
|
-
|
|
46
|
+
if (buf[offset] < 0x80) {
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
if (buf[offset] === 0x80) {
|
|
50
|
+
throw new Error('Invalid length 0');
|
|
51
|
+
}
|
|
52
|
+
if (buf[offset] === 0x81) {
|
|
53
|
+
return 2;
|
|
54
|
+
}
|
|
55
|
+
if (buf[offset] === 0x82) {
|
|
56
|
+
return 3;
|
|
57
|
+
}
|
|
58
|
+
if (buf[offset] === 0x83) {
|
|
59
|
+
return 4;
|
|
60
|
+
}
|
|
47
61
|
throw new Error('Length too long (> 4 bytes)');
|
|
48
62
|
};
|
|
49
63
|
|
|
50
64
|
export const decodeLen = (buf: Uint8Array, offset: number): number => {
|
|
51
65
|
const lenBytes = decodeLenBytes(buf, offset);
|
|
52
|
-
if (lenBytes === 1)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
if (lenBytes === 1) {
|
|
67
|
+
return buf[offset];
|
|
68
|
+
}
|
|
69
|
+
if (lenBytes === 2) {
|
|
70
|
+
return buf[offset + 1];
|
|
71
|
+
}
|
|
72
|
+
if (lenBytes === 3) {
|
|
73
|
+
return (buf[offset + 1] << 8) + buf[offset + 2];
|
|
74
|
+
}
|
|
75
|
+
if (lenBytes === 4) {
|
|
56
76
|
return (buf[offset + 1] << 16) + (buf[offset + 2] << 8) + buf[offset + 3];
|
|
77
|
+
}
|
|
57
78
|
throw new Error('Length too long (> 4 bytes)');
|
|
58
79
|
};
|
|
59
80
|
|
|
@@ -129,7 +150,7 @@ export const unwrapDER = (derEncoded: Uint8Array, oid: Uint8Array): Uint8Array =
|
|
|
129
150
|
let offset = 0;
|
|
130
151
|
const expect = (n: number, msg: string) => {
|
|
131
152
|
if (buf[offset++] !== n) {
|
|
132
|
-
throw new Error(
|
|
153
|
+
throw new Error(`Expected: ${msg}`);
|
|
133
154
|
}
|
|
134
155
|
};
|
|
135
156
|
|
|
@@ -34,6 +34,6 @@ export function pemToSecretKey(pem: string): Uint8Array {
|
|
|
34
34
|
// Returns the 32-byte raw private key at the appropriate offset
|
|
35
35
|
return rawKey.slice(7, 39);
|
|
36
36
|
} catch (error) {
|
|
37
|
-
throw new Error(`Encountered error while parsing PEM key: ${error}
|
|
37
|
+
throw new Error(`Encountered error while parsing PEM key: ${error}`, { cause: error });
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -42,20 +42,26 @@ export class Secp256k1PublicKey implements PublicKey {
|
|
|
42
42
|
if (typeof maybeKey === 'string') {
|
|
43
43
|
const key = hexToBytes(maybeKey);
|
|
44
44
|
return this.fromRaw(key);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
|
+
if (isObject(maybeKey)) {
|
|
46
47
|
const key = maybeKey as KeyLike;
|
|
47
48
|
if (isObject(key) && Object.hasOwnProperty.call(key, '__derEncodedPublicKey__')) {
|
|
48
49
|
return this.fromDer(key as DerEncodedPublicKey);
|
|
49
|
-
}
|
|
50
|
+
}
|
|
51
|
+
if (ArrayBuffer.isView(key)) {
|
|
50
52
|
const view = key as ArrayBufferView;
|
|
51
53
|
return this.fromRaw(uint8FromBufLike(view.buffer));
|
|
52
|
-
}
|
|
54
|
+
}
|
|
55
|
+
if (key instanceof ArrayBuffer) {
|
|
53
56
|
return this.fromRaw(uint8FromBufLike(key));
|
|
54
|
-
}
|
|
57
|
+
}
|
|
58
|
+
if ('rawKey' in key && key['rawKey'] !== undefined) {
|
|
55
59
|
return this.fromRaw(key.rawKey);
|
|
56
|
-
}
|
|
60
|
+
}
|
|
61
|
+
if ('derKey' in key) {
|
|
57
62
|
return this.fromDer(key.derKey as DerEncodedPublicKey);
|
|
58
|
-
}
|
|
63
|
+
}
|
|
64
|
+
if ('toDer' in key) {
|
|
59
65
|
return this.fromDer(key.toDer());
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -9,9 +9,9 @@ const ANONYMOUS_SUFFIX = 4;
|
|
|
9
9
|
|
|
10
10
|
const MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR = 'aaaaa-aa';
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export interface JsonnablePrincipal {
|
|
13
13
|
[JSON_KEY_PRINCIPAL]: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
export class Principal {
|
|
17
17
|
public static anonymous(): Principal {
|
|
@@ -34,9 +34,11 @@ export class Principal {
|
|
|
34
34
|
public static from(other: unknown): Principal {
|
|
35
35
|
if (typeof other === 'string') {
|
|
36
36
|
return Principal.fromText(other);
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
|
+
if (Object.getPrototypeOf(other) === Uint8Array.prototype) {
|
|
38
39
|
return new Principal(other as Uint8Array);
|
|
39
|
-
}
|
|
40
|
+
}
|
|
41
|
+
if (Principal.isPrincipal(other)) {
|
|
40
42
|
return new Principal(other._arr);
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -140,12 +142,20 @@ export class Principal {
|
|
|
140
142
|
*/
|
|
141
143
|
public compareTo(other: Principal): 'lt' | 'eq' | 'gt' {
|
|
142
144
|
for (let i = 0; i < Math.min(this._arr.length, other._arr.length); i++) {
|
|
143
|
-
if (this._arr[i] < other._arr[i])
|
|
144
|
-
|
|
145
|
+
if (this._arr[i] < other._arr[i]) {
|
|
146
|
+
return 'lt';
|
|
147
|
+
}
|
|
148
|
+
if (this._arr[i] > other._arr[i]) {
|
|
149
|
+
return 'gt';
|
|
150
|
+
}
|
|
145
151
|
}
|
|
146
152
|
// Here, at least one principal is a prefix of the other principal (they could be the same)
|
|
147
|
-
if (this._arr.length < other._arr.length)
|
|
148
|
-
|
|
153
|
+
if (this._arr.length < other._arr.length) {
|
|
154
|
+
return 'lt';
|
|
155
|
+
}
|
|
156
|
+
if (this._arr.length > other._arr.length) {
|
|
157
|
+
return 'gt';
|
|
158
|
+
}
|
|
149
159
|
return 'eq';
|
|
150
160
|
}
|
|
151
161
|
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2020 DFINITY Stiftung.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|