@icp-sdk/core 4.2.3 → 5.0.0-beta.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 +203 -0
- package/lib/cjs/agent/actor.d.ts.map +1 -0
- package/lib/cjs/agent/actor.js +341 -0
- package/lib/cjs/agent/actor.js.map +1 -0
- package/lib/cjs/agent/agent/api.d.ts +216 -0
- package/lib/cjs/agent/agent/api.d.ts.map +1 -0
- package/lib/cjs/agent/agent/api.js +39 -0
- package/lib/cjs/agent/agent/api.js.map +1 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.d.ts +7 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.js +19 -0
- package/lib/cjs/agent/agent/http/__certificates__/goldenCertificates.js.map +1 -0
- package/lib/cjs/agent/agent/http/index.d.ts +171 -0
- package/lib/cjs/agent/agent/http/index.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/index.js +1079 -0
- package/lib/cjs/agent/agent/http/index.js.map +1 -0
- package/lib/cjs/agent/agent/http/transforms.d.ts +54 -0
- package/lib/cjs/agent/agent/http/transforms.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/transforms.js +135 -0
- package/lib/cjs/agent/agent/http/transforms.js.map +1 -0
- package/lib/cjs/agent/agent/http/types.d.ts +81 -0
- package/lib/cjs/agent/agent/http/types.d.ts.map +1 -0
- package/lib/cjs/agent/agent/http/types.js +43 -0
- package/lib/cjs/agent/agent/http/types.js.map +1 -0
- package/lib/cjs/agent/agent/index.d.ts +3 -0
- package/lib/cjs/agent/agent/index.d.ts.map +1 -0
- package/lib/cjs/agent/agent/index.js +19 -0
- package/lib/cjs/agent/agent/index.js.map +1 -0
- package/lib/cjs/agent/auth.d.ts +91 -0
- package/lib/cjs/agent/auth.d.ts.map +1 -0
- package/lib/cjs/agent/auth.js +65 -0
- package/lib/cjs/agent/auth.js.map +1 -0
- package/lib/cjs/agent/canisterStatus/index.d.ts +93 -0
- package/lib/cjs/agent/canisterStatus/index.d.ts.map +1 -0
- package/lib/cjs/agent/canisterStatus/index.js +301 -0
- package/lib/cjs/agent/canisterStatus/index.js.map +1 -0
- package/lib/cjs/agent/cbor.d.ts +26 -0
- package/lib/cjs/agent/cbor.d.ts.map +1 -0
- package/lib/cjs/agent/cbor.js +93 -0
- package/lib/cjs/agent/cbor.js.map +1 -0
- package/lib/cjs/agent/certificate.d.ts +228 -0
- package/lib/cjs/agent/certificate.d.ts.map +1 -0
- package/lib/cjs/agent/certificate.js +591 -0
- package/lib/cjs/agent/certificate.js.map +1 -0
- package/lib/cjs/agent/constants.d.ts +14 -0
- package/lib/cjs/agent/constants.d.ts.map +1 -0
- package/lib/cjs/agent/constants.js +18 -0
- package/lib/cjs/agent/constants.js.map +1 -0
- package/lib/cjs/agent/der.d.ts +34 -0
- package/lib/cjs/agent/der.d.ts.map +1 -0
- package/lib/cjs/agent/der.js +175 -0
- package/lib/cjs/agent/der.js.map +1 -0
- package/lib/cjs/agent/errors.d.ts +380 -0
- package/lib/cjs/agent/errors.d.ts.map +1 -0
- package/lib/cjs/agent/errors.js +733 -0
- package/lib/cjs/agent/errors.js.map +1 -0
- package/lib/cjs/agent/fetch_candid.d.ts +9 -0
- package/lib/cjs/agent/fetch_candid.d.ts.map +1 -0
- package/lib/cjs/agent/fetch_candid.js +69 -0
- package/lib/cjs/agent/fetch_candid.js.map +1 -0
- package/lib/cjs/agent/index.d.ts +31 -1
- package/lib/cjs/agent/index.d.ts.map +1 -1
- package/lib/cjs/agent/index.js +59 -1
- package/lib/cjs/agent/index.js.map +1 -1
- package/lib/cjs/agent/observable.d.ts +24 -0
- package/lib/cjs/agent/observable.d.ts.map +1 -0
- package/lib/cjs/agent/observable.js +34 -0
- package/lib/cjs/agent/observable.js.map +1 -0
- package/lib/cjs/agent/polling/backoff.d.ts +50 -0
- package/lib/cjs/agent/polling/backoff.d.ts.map +1 -0
- package/lib/cjs/agent/polling/backoff.js +90 -0
- package/lib/cjs/agent/polling/backoff.js.map +1 -0
- package/lib/cjs/agent/polling/index.d.ts +63 -0
- package/lib/cjs/agent/polling/index.d.ts.map +1 -0
- package/lib/cjs/agent/polling/index.js +183 -0
- package/lib/cjs/agent/polling/index.js.map +1 -0
- package/lib/cjs/agent/polling/strategy.d.ts +52 -0
- package/lib/cjs/agent/polling/strategy.d.ts.map +1 -0
- package/lib/cjs/agent/polling/strategy.js +104 -0
- package/lib/cjs/agent/polling/strategy.js.map +1 -0
- package/lib/cjs/agent/public_key.d.ts +16 -0
- package/lib/cjs/agent/public_key.d.ts.map +1 -0
- package/lib/cjs/agent/public_key.js +52 -0
- package/lib/cjs/agent/public_key.js.map +1 -0
- package/lib/cjs/agent/request_id.d.ts +24 -0
- package/lib/cjs/agent/request_id.d.ts.map +1 -0
- package/lib/cjs/agent/request_id.js +88 -0
- package/lib/cjs/agent/request_id.js.map +1 -0
- package/lib/cjs/agent/utils/bls.d.ts +10 -0
- package/lib/cjs/agent/utils/bls.d.ts.map +1 -0
- package/lib/cjs/agent/utils/bls.js +20 -0
- package/lib/cjs/agent/utils/bls.js.map +1 -0
- package/lib/cjs/agent/utils/buffer.d.ts +22 -0
- package/lib/cjs/agent/utils/buffer.d.ts.map +1 -0
- package/lib/cjs/agent/utils/buffer.js +55 -0
- package/lib/cjs/agent/utils/buffer.js.map +1 -0
- package/lib/cjs/agent/utils/expirableMap.d.ts +80 -0
- package/lib/cjs/agent/utils/expirableMap.d.ts.map +1 -0
- package/lib/cjs/agent/utils/expirableMap.js +148 -0
- package/lib/cjs/agent/utils/expirableMap.js.map +1 -0
- package/lib/cjs/agent/utils/leb.d.ts +3 -0
- package/lib/cjs/agent/utils/leb.d.ts.map +1 -0
- package/lib/cjs/agent/utils/leb.js +17 -0
- package/lib/cjs/agent/utils/leb.js.map +1 -0
- package/lib/cjs/agent/utils/random.d.ts +6 -0
- package/lib/cjs/agent/utils/random.d.ts.map +1 -0
- package/lib/cjs/agent/utils/random.js +29 -0
- package/lib/cjs/agent/utils/random.js.map +1 -0
- package/lib/cjs/candid/candid-core.d.ts +72 -0
- package/lib/cjs/candid/candid-core.d.ts.map +1 -0
- package/lib/cjs/candid/candid-core.js +251 -0
- package/lib/cjs/candid/candid-core.js.map +1 -0
- package/lib/cjs/candid/candid-ui.d.ts +35 -0
- package/lib/cjs/candid/candid-ui.d.ts.map +1 -0
- package/lib/cjs/candid/candid-ui.js +317 -0
- package/lib/cjs/candid/candid-ui.js.map +1 -0
- package/lib/cjs/candid/idl.d.ts +579 -0
- package/lib/cjs/candid/idl.d.ts.map +1 -0
- package/lib/cjs/candid/idl.js +2228 -0
- package/lib/cjs/candid/idl.js.map +1 -0
- package/lib/cjs/candid/index.d.ts +11 -1
- package/lib/cjs/candid/index.d.ts.map +1 -1
- package/lib/cjs/candid/index.js +33 -1
- package/lib/cjs/candid/index.js.map +1 -1
- package/lib/cjs/candid/types.d.ts +6 -0
- package/lib/cjs/candid/types.d.ts.map +1 -0
- package/lib/cjs/candid/types.js +4 -0
- package/lib/cjs/candid/types.js.map +1 -0
- package/lib/cjs/candid/utils/bigint-math.d.ts +14 -0
- package/lib/cjs/candid/utils/bigint-math.d.ts.map +1 -0
- package/lib/cjs/candid/utils/bigint-math.js +30 -0
- package/lib/cjs/candid/utils/bigint-math.js.map +1 -0
- package/lib/cjs/candid/utils/buffer.d.ts +86 -0
- package/lib/cjs/candid/utils/buffer.d.ts.map +1 -0
- package/lib/cjs/candid/utils/buffer.js +191 -0
- package/lib/cjs/candid/utils/buffer.js.map +1 -0
- package/lib/cjs/candid/utils/hash.d.ts +7 -0
- package/lib/cjs/candid/utils/hash.d.ts.map +1 -0
- package/lib/cjs/candid/utils/hash.js +33 -0
- package/lib/cjs/candid/utils/hash.js.map +1 -0
- package/lib/cjs/candid/utils/leb128.d.ts +65 -0
- package/lib/cjs/candid/utils/leb128.d.ts.map +1 -0
- package/lib/cjs/candid/utils/leb128.js +228 -0
- package/lib/cjs/candid/utils/leb128.js.map +1 -0
- package/lib/cjs/identity/identity/delegation.d.ts +164 -0
- package/lib/cjs/identity/identity/delegation.d.ts.map +1 -0
- package/lib/cjs/identity/identity/delegation.js +302 -0
- package/lib/cjs/identity/identity/delegation.js.map +1 -0
- package/lib/cjs/identity/identity/ecdsa.d.ts +62 -0
- package/lib/cjs/identity/identity/ecdsa.d.ts.map +1 -0
- package/lib/cjs/identity/identity/ecdsa.js +117 -0
- package/lib/cjs/identity/identity/ecdsa.js.map +1 -0
- package/lib/cjs/identity/identity/ed25519.d.ts +67 -0
- package/lib/cjs/identity/identity/ed25519.d.ts.map +1 -0
- package/lib/cjs/identity/identity/ed25519.js +200 -0
- package/lib/cjs/identity/identity/ed25519.js.map +1 -0
- package/lib/cjs/identity/identity/partial.d.ts +34 -0
- package/lib/cjs/identity/identity/partial.d.ts.map +1 -0
- package/lib/cjs/identity/identity/partial.js +54 -0
- package/lib/cjs/identity/identity/partial.js.map +1 -0
- package/lib/cjs/identity/identity/webauthn.d.ts +51 -0
- package/lib/cjs/identity/identity/webauthn.d.ts.map +1 -0
- package/lib/cjs/identity/identity/webauthn.js +197 -0
- package/lib/cjs/identity/identity/webauthn.js.map +1 -0
- package/lib/cjs/identity/index.d.ts +15 -1
- package/lib/cjs/identity/index.d.ts.map +1 -1
- package/lib/cjs/identity/index.js +24 -1
- package/lib/cjs/identity/index.js.map +1 -1
- package/lib/cjs/identity/secp256k1/der.d.ts +33 -0
- package/lib/cjs/identity/secp256k1/der.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/der.js +165 -0
- package/lib/cjs/identity/secp256k1/der.js.map +1 -0
- package/lib/cjs/identity/secp256k1/index.d.ts +4 -1
- package/lib/cjs/identity/secp256k1/index.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/index.js +4 -1
- package/lib/cjs/identity/secp256k1/index.js.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.d.ts +7 -0
- package/lib/cjs/identity/secp256k1/pem.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/pem.js +75 -0
- package/lib/cjs/identity/secp256k1/pem.js.map +1 -0
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts +87 -0
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts.map +1 -0
- package/lib/cjs/identity/secp256k1/secp256k1.js +260 -0
- package/lib/cjs/identity/secp256k1/secp256k1.js.map +1 -0
- package/lib/cjs/principal/index.d.ts +3 -1
- package/lib/cjs/principal/index.d.ts.map +1 -1
- package/lib/cjs/principal/index.js +7 -1
- package/lib/cjs/principal/index.js.map +1 -1
- package/lib/cjs/principal/principal.d.ts +50 -0
- package/lib/cjs/principal/principal.d.ts.map +1 -0
- package/lib/cjs/principal/principal.js +148 -0
- package/lib/cjs/principal/principal.js.map +1 -0
- package/lib/cjs/principal/utils/base32.d.ts +10 -0
- package/lib/cjs/principal/utils/base32.d.ts.map +1 -0
- package/lib/cjs/principal/utils/base32.js +90 -0
- package/lib/cjs/principal/utils/base32.js.map +1 -0
- package/lib/cjs/principal/utils/getCrc.d.ts +6 -0
- package/lib/cjs/principal/utils/getCrc.d.ts.map +1 -0
- package/lib/cjs/principal/utils/getCrc.js +53 -0
- package/lib/cjs/principal/utils/getCrc.js.map +1 -0
- package/lib/esm/agent/actor.d.ts +203 -0
- package/lib/esm/agent/actor.d.ts.map +1 -0
- package/lib/esm/agent/actor.js +337 -0
- package/lib/esm/agent/actor.js.map +1 -0
- package/lib/esm/agent/agent/api.d.ts +216 -0
- package/lib/esm/agent/agent/api.d.ts.map +1 -0
- package/lib/esm/agent/agent/api.js +34 -0
- package/lib/esm/agent/agent/api.js.map +1 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.d.ts +7 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.js +16 -0
- package/lib/esm/agent/agent/http/__certificates__/goldenCertificates.js.map +1 -0
- package/lib/esm/agent/agent/http/index.d.ts +171 -0
- package/lib/esm/agent/agent/http/index.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/index.js +1037 -0
- package/lib/esm/agent/agent/http/index.js.map +1 -0
- package/lib/esm/agent/agent/http/transforms.d.ts +54 -0
- package/lib/esm/agent/agent/http/transforms.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/transforms.js +128 -0
- package/lib/esm/agent/agent/http/transforms.js.map +1 -0
- package/lib/esm/agent/agent/http/types.d.ts +81 -0
- package/lib/esm/agent/agent/http/types.d.ts.map +1 -0
- package/lib/esm/agent/agent/http/types.js +39 -0
- package/lib/esm/agent/agent/http/types.js.map +1 -0
- package/lib/esm/agent/agent/index.d.ts +3 -0
- package/lib/esm/agent/agent/index.d.ts.map +1 -0
- package/lib/esm/agent/agent/index.js +3 -0
- package/lib/esm/agent/agent/index.js.map +1 -0
- package/lib/esm/agent/auth.d.ts +91 -0
- package/lib/esm/agent/auth.d.ts.map +1 -0
- package/lib/esm/agent/auth.js +59 -0
- package/lib/esm/agent/auth.js.map +1 -0
- package/lib/esm/agent/canister-env/index.d.ts +110 -1
- package/lib/esm/agent/canister-env/index.d.ts.map +1 -1
- package/lib/esm/agent/canister-env/index.js +110 -1
- package/lib/esm/agent/canister-env/index.js.map +1 -1
- package/lib/esm/agent/canisterStatus/index.d.ts +93 -0
- package/lib/esm/agent/canisterStatus/index.d.ts.map +1 -0
- package/lib/esm/agent/canisterStatus/index.js +261 -0
- package/lib/esm/agent/canisterStatus/index.js.map +1 -0
- package/lib/esm/agent/cbor.d.ts +26 -0
- package/lib/esm/agent/cbor.d.ts.map +1 -0
- package/lib/esm/agent/cbor.js +54 -0
- package/lib/esm/agent/cbor.js.map +1 -0
- package/lib/esm/agent/certificate.d.ts +228 -0
- package/lib/esm/agent/certificate.d.ts.map +1 -0
- package/lib/esm/agent/certificate.js +545 -0
- package/lib/esm/agent/certificate.js.map +1 -0
- package/lib/esm/agent/constants.d.ts +14 -0
- package/lib/esm/agent/constants.d.ts.map +1 -0
- package/lib/esm/agent/constants.js +15 -0
- package/lib/esm/agent/constants.js.map +1 -0
- package/lib/esm/agent/der.d.ts +34 -0
- package/lib/esm/agent/der.d.ts.map +1 -0
- package/lib/esm/agent/der.js +166 -0
- package/lib/esm/agent/der.js.map +1 -0
- package/lib/esm/agent/errors.d.ts +380 -0
- package/lib/esm/agent/errors.d.ts.map +1 -0
- package/lib/esm/agent/errors.js +678 -0
- package/lib/esm/agent/errors.js.map +1 -0
- package/lib/esm/agent/fetch_candid.d.ts +9 -0
- package/lib/esm/agent/fetch_candid.d.ts.map +1 -0
- package/lib/esm/agent/fetch_candid.js +33 -0
- package/lib/esm/agent/fetch_candid.js.map +1 -0
- package/lib/esm/agent/index.d.ts +31 -1
- package/lib/esm/agent/index.d.ts.map +1 -1
- package/lib/esm/agent/index.js +31 -1
- package/lib/esm/agent/index.js.map +1 -1
- package/lib/esm/agent/observable.d.ts +24 -0
- package/lib/esm/agent/observable.d.ts.map +1 -0
- package/lib/esm/agent/observable.js +29 -0
- package/lib/esm/agent/observable.js.map +1 -0
- package/lib/esm/agent/polling/backoff.d.ts +50 -0
- package/lib/esm/agent/polling/backoff.d.ts.map +1 -0
- package/lib/esm/agent/polling/backoff.js +85 -0
- package/lib/esm/agent/polling/backoff.js.map +1 -0
- package/lib/esm/agent/polling/index.d.ts +63 -0
- package/lib/esm/agent/polling/index.d.ts.map +1 -0
- package/lib/esm/agent/polling/index.js +144 -0
- package/lib/esm/agent/polling/index.js.map +1 -0
- package/lib/esm/agent/polling/strategy.d.ts +52 -0
- package/lib/esm/agent/polling/strategy.d.ts.map +1 -0
- package/lib/esm/agent/polling/strategy.js +94 -0
- package/lib/esm/agent/polling/strategy.js.map +1 -0
- package/lib/esm/agent/public_key.d.ts +16 -0
- package/lib/esm/agent/public_key.d.ts.map +1 -0
- package/lib/esm/agent/public_key.js +48 -0
- package/lib/esm/agent/public_key.js.map +1 -0
- package/lib/esm/agent/request_id.d.ts +24 -0
- package/lib/esm/agent/request_id.d.ts.map +1 -0
- package/lib/esm/agent/request_id.js +83 -0
- package/lib/esm/agent/request_id.js.map +1 -0
- package/lib/esm/agent/utils/bls.d.ts +10 -0
- package/lib/esm/agent/utils/bls.d.ts.map +1 -0
- package/lib/esm/agent/utils/bls.js +17 -0
- package/lib/esm/agent/utils/bls.js.map +1 -0
- package/lib/esm/agent/utils/buffer.d.ts +22 -0
- package/lib/esm/agent/utils/buffer.d.ts.map +1 -0
- package/lib/esm/agent/utils/buffer.js +50 -0
- package/lib/esm/agent/utils/buffer.js.map +1 -0
- package/lib/esm/agent/utils/expirableMap.d.ts +80 -0
- package/lib/esm/agent/utils/expirableMap.d.ts.map +1 -0
- package/lib/esm/agent/utils/expirableMap.js +144 -0
- package/lib/esm/agent/utils/expirableMap.js.map +1 -0
- package/lib/esm/agent/utils/leb.d.ts +3 -0
- package/lib/esm/agent/utils/leb.d.ts.map +1 -0
- package/lib/esm/agent/utils/leb.js +12 -0
- package/lib/esm/agent/utils/leb.js.map +1 -0
- package/lib/esm/agent/utils/random.d.ts +6 -0
- package/lib/esm/agent/utils/random.d.ts.map +1 -0
- package/lib/esm/agent/utils/random.js +25 -0
- package/lib/esm/agent/utils/random.js.map +1 -0
- package/lib/esm/candid/candid-core.d.ts +72 -0
- package/lib/esm/candid/candid-core.d.ts.map +1 -0
- package/lib/esm/candid/candid-core.js +241 -0
- package/lib/esm/candid/candid-core.js.map +1 -0
- package/lib/esm/candid/candid-ui.d.ts +35 -0
- package/lib/esm/candid/candid-ui.d.ts.map +1 -0
- package/lib/esm/candid/candid-ui.js +272 -0
- package/lib/esm/candid/candid-ui.js.map +1 -0
- package/lib/esm/candid/idl.d.ts +579 -0
- package/lib/esm/candid/idl.d.ts.map +1 -0
- package/lib/esm/candid/idl.js +2189 -0
- package/lib/esm/candid/idl.js.map +1 -0
- package/lib/esm/candid/index.d.ts +11 -1
- package/lib/esm/candid/index.d.ts.map +1 -1
- package/lib/esm/candid/index.js +10 -1
- package/lib/esm/candid/index.js.map +1 -1
- package/lib/esm/candid/types.d.ts +6 -0
- package/lib/esm/candid/types.d.ts.map +1 -0
- package/lib/esm/candid/types.js +3 -0
- package/lib/esm/candid/types.js.map +1 -0
- package/lib/esm/candid/utils/bigint-math.d.ts +14 -0
- package/lib/esm/candid/utils/bigint-math.d.ts.map +1 -0
- package/lib/esm/candid/utils/bigint-math.js +26 -0
- package/lib/esm/candid/utils/bigint-math.js.map +1 -0
- package/lib/esm/candid/utils/buffer.d.ts +86 -0
- package/lib/esm/candid/utils/buffer.d.ts.map +1 -0
- package/lib/esm/candid/utils/buffer.js +182 -0
- package/lib/esm/candid/utils/buffer.js.map +1 -0
- package/lib/esm/candid/utils/hash.d.ts +7 -0
- package/lib/esm/candid/utils/hash.d.ts.map +1 -0
- package/lib/esm/candid/utils/hash.js +30 -0
- package/lib/esm/candid/utils/hash.js.map +1 -0
- package/lib/esm/candid/utils/leb128.d.ts +65 -0
- package/lib/esm/candid/utils/leb128.d.ts.map +1 -0
- package/lib/esm/candid/utils/leb128.js +216 -0
- package/lib/esm/candid/utils/leb128.js.map +1 -0
- package/lib/esm/identity/identity/delegation.d.ts +164 -0
- package/lib/esm/identity/identity/delegation.d.ts.map +1 -0
- package/lib/esm/identity/identity/delegation.js +294 -0
- package/lib/esm/identity/identity/delegation.js.map +1 -0
- package/lib/esm/identity/identity/ecdsa.d.ts +62 -0
- package/lib/esm/identity/identity/ecdsa.d.ts.map +1 -0
- package/lib/esm/identity/identity/ecdsa.js +112 -0
- package/lib/esm/identity/identity/ecdsa.js.map +1 -0
- package/lib/esm/identity/identity/ed25519.d.ts +67 -0
- package/lib/esm/identity/identity/ed25519.d.ts.map +1 -0
- package/lib/esm/identity/identity/ed25519.js +195 -0
- package/lib/esm/identity/identity/ed25519.js.map +1 -0
- package/lib/esm/identity/identity/partial.d.ts +34 -0
- package/lib/esm/identity/identity/partial.d.ts.map +1 -0
- package/lib/esm/identity/identity/partial.js +50 -0
- package/lib/esm/identity/identity/partial.js.map +1 -0
- package/lib/esm/identity/identity/webauthn.d.ts +51 -0
- package/lib/esm/identity/identity/webauthn.d.ts.map +1 -0
- package/lib/esm/identity/identity/webauthn.js +192 -0
- package/lib/esm/identity/identity/webauthn.js.map +1 -0
- package/lib/esm/identity/index.d.ts +15 -1
- package/lib/esm/identity/index.d.ts.map +1 -1
- package/lib/esm/identity/index.js +17 -1
- package/lib/esm/identity/index.js.map +1 -1
- package/lib/esm/identity/secp256k1/der.d.ts +33 -0
- package/lib/esm/identity/secp256k1/der.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/der.js +156 -0
- package/lib/esm/identity/secp256k1/der.js.map +1 -0
- package/lib/esm/identity/secp256k1/index.d.ts +4 -1
- package/lib/esm/identity/secp256k1/index.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/index.js +4 -1
- package/lib/esm/identity/secp256k1/index.js.map +1 -1
- package/lib/esm/identity/secp256k1/pem.d.ts +7 -0
- package/lib/esm/identity/secp256k1/pem.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/pem.js +39 -0
- package/lib/esm/identity/secp256k1/pem.js.map +1 -0
- package/lib/esm/identity/secp256k1/secp256k1.d.ts +87 -0
- package/lib/esm/identity/secp256k1/secp256k1.d.ts.map +1 -0
- package/lib/esm/identity/secp256k1/secp256k1.js +222 -0
- package/lib/esm/identity/secp256k1/secp256k1.js.map +1 -0
- package/lib/esm/principal/index.d.ts +3 -1
- package/lib/esm/principal/index.d.ts.map +1 -1
- package/lib/esm/principal/index.js +3 -1
- package/lib/esm/principal/index.js.map +1 -1
- package/lib/esm/principal/principal.d.ts +50 -0
- package/lib/esm/principal/principal.d.ts.map +1 -0
- package/lib/esm/principal/principal.js +144 -0
- package/lib/esm/principal/principal.js.map +1 -0
- package/lib/esm/principal/utils/base32.d.ts +10 -0
- package/lib/esm/principal/utils/base32.d.ts.map +1 -0
- package/lib/esm/principal/utils/base32.js +86 -0
- package/lib/esm/principal/utils/base32.js.map +1 -0
- package/lib/esm/principal/utils/getCrc.d.ts +6 -0
- package/lib/esm/principal/utils/getCrc.d.ts.map +1 -0
- package/lib/esm/principal/utils/getCrc.js +50 -0
- package/lib/esm/principal/utils/getCrc.js.map +1 -0
- package/package.json +17 -11
- package/src/agent/actor.ts +576 -0
- package/src/agent/agent/api.ts +262 -0
- package/src/agent/agent/http/index.ts +1405 -0
- package/src/agent/agent/http/transforms.ts +158 -0
- package/src/agent/agent/http/types.ts +126 -0
- package/src/agent/agent/index.ts +2 -0
- package/src/agent/auth.ts +147 -0
- package/src/agent/canister-env/index.ts +191 -1
- package/src/agent/canisterStatus/index.ts +412 -0
- package/src/agent/cbor.ts +63 -0
- package/src/agent/certificate.ts +841 -0
- package/src/agent/constants.ts +19 -0
- package/src/agent/der.ts +170 -0
- package/src/agent/errors.ts +868 -0
- package/src/agent/fetch_candid.ts +37 -0
- package/src/agent/index.ts +37 -1
- package/src/agent/observable.ts +49 -0
- package/src/agent/polling/backoff.ts +130 -0
- package/src/agent/polling/index.ts +250 -0
- package/src/agent/polling/strategy.ts +144 -0
- package/src/agent/public_key.ts +65 -0
- package/src/agent/request_id.ts +92 -0
- package/src/agent/utils/bls.ts +18 -0
- package/src/agent/utils/buffer.ts +60 -0
- package/src/agent/utils/expirableMap.ts +163 -0
- package/src/agent/utils/leb.ts +14 -0
- package/src/agent/utils/random.ts +30 -0
- package/src/candid/candid-core.ts +276 -0
- package/src/candid/candid-ui.ts +289 -0
- package/src/candid/idl.ts +2556 -0
- package/src/candid/index.ts +16 -1
- package/src/candid/types.ts +7 -0
- package/src/candid/utils/bigint-math.ts +26 -0
- package/src/candid/utils/buffer.ts +221 -0
- package/src/candid/utils/hash.ts +31 -0
- package/src/candid/utils/leb128.ts +234 -0
- package/src/identity/identity/delegation.ts +411 -0
- package/src/identity/identity/ecdsa.ts +158 -0
- package/src/identity/identity/ed25519.ts +239 -0
- package/src/identity/identity/partial.ts +60 -0
- package/src/identity/identity/webauthn.ts +265 -0
- package/src/identity/index.ts +19 -1
- package/src/identity/secp256k1/der.ts +156 -0
- package/src/identity/secp256k1/index.ts +5 -1
- package/src/identity/secp256k1/pem.ts +40 -0
- package/src/identity/secp256k1/secp256k1.ts +270 -0
- package/src/package.json +4 -0
- package/src/principal/index.ts +3 -1
- package/src/principal/principal.ts +171 -0
- package/src/principal/utils/base32.ts +101 -0
- package/src/principal/utils/getCrc.ts +52 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.idlLabelToId = idlLabelToId;
|
|
4
|
+
/**
|
|
5
|
+
* Hashes a string to a number. Algorithm can be found here:
|
|
6
|
+
* https://caml.inria.fr/pub/papers/garrigue-polymorphic_variants-ml98.pdf
|
|
7
|
+
* @param s - string to hash
|
|
8
|
+
* @returns number representing hashed string
|
|
9
|
+
*/
|
|
10
|
+
function idlHash(s) {
|
|
11
|
+
const utf8encoder = new TextEncoder();
|
|
12
|
+
const array = utf8encoder.encode(s);
|
|
13
|
+
let h = 0;
|
|
14
|
+
for (const c of array) {
|
|
15
|
+
h = (h * 223 + c) % 2 ** 32;
|
|
16
|
+
}
|
|
17
|
+
return h;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param label string
|
|
22
|
+
* @returns number representing hashed label
|
|
23
|
+
*/
|
|
24
|
+
function idlLabelToId(label) {
|
|
25
|
+
if (/^_\d+_$/.test(label) || /^_0x[0-9a-fA-F]+_$/.test(label)) {
|
|
26
|
+
const num = +label.slice(1, -1);
|
|
27
|
+
if (Number.isSafeInteger(num) && num >= 0 && num < 2 ** 32) {
|
|
28
|
+
return num;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return idlHash(label);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../src/candid/utils/hash.ts"],"names":[],"mappings":";;AAsBA,oCAQC;AA9BD;;;;;GAKG;AACH,SAAS,OAAO,CAAC,CAAS;IACxB,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEpC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3D,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { PipeArrayBuffer as Pipe } from './buffer.ts';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param pipe Pipe from buffer-pipe
|
|
5
|
+
* @param num number
|
|
6
|
+
* @returns Uint8Array
|
|
7
|
+
*/
|
|
8
|
+
export declare function safeRead(pipe: Pipe, num: number): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* @param pipe - PipeArrayBuffer simulating buffer-pipe api
|
|
11
|
+
*/
|
|
12
|
+
export declare function safeReadUint8(pipe: Pipe): number;
|
|
13
|
+
/**
|
|
14
|
+
* Encode a positive number (or bigint) into a Buffer. The number will be floored to the
|
|
15
|
+
* nearest integer.
|
|
16
|
+
* @param value The number to encode.
|
|
17
|
+
*/
|
|
18
|
+
export declare function lebEncode(value: bigint | number): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Decode a leb encoded buffer into a bigint. The number will always be positive (does not
|
|
21
|
+
* support signed leb encoding).
|
|
22
|
+
* @param pipe A Buffer containing the leb encoded bits.
|
|
23
|
+
*/
|
|
24
|
+
export declare function lebDecode(pipe: Pipe): bigint;
|
|
25
|
+
/**
|
|
26
|
+
* Encode a number (or bigint) into a Buffer, with support for negative numbers. The number
|
|
27
|
+
* will be floored to the nearest integer.
|
|
28
|
+
* @param value The number to encode.
|
|
29
|
+
*/
|
|
30
|
+
export declare function slebEncode(value: bigint | number): Uint8Array;
|
|
31
|
+
/**
|
|
32
|
+
* Decode a leb encoded buffer into a bigint. The number is decoded with support for negative
|
|
33
|
+
* signed-leb encoding.
|
|
34
|
+
* @param pipe A Buffer containing the signed leb encoded bits.
|
|
35
|
+
*/
|
|
36
|
+
export declare function slebDecode(pipe: Pipe): bigint;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param value bigint or number
|
|
40
|
+
* @param byteLength number
|
|
41
|
+
* @returns Uint8Array
|
|
42
|
+
*/
|
|
43
|
+
export declare function writeUIntLE(value: bigint | number, byteLength: number): Uint8Array;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param value - bigint or number
|
|
47
|
+
* @param byteLength - number
|
|
48
|
+
* @returns Uint8Array
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeIntLE(value: bigint | number, byteLength: number): Uint8Array;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param pipe Pipe from buffer-pipe
|
|
54
|
+
* @param byteLength number
|
|
55
|
+
* @returns bigint
|
|
56
|
+
*/
|
|
57
|
+
export declare function readUIntLE(pipe: Pipe, byteLength: number): bigint;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param pipe Pipe from buffer-pipe
|
|
61
|
+
* @param byteLength number
|
|
62
|
+
* @returns bigint
|
|
63
|
+
*/
|
|
64
|
+
export declare function readIntLE(pipe: Pipe, byteLength: number): bigint;
|
|
65
|
+
//# sourceMappingURL=leb128.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leb128.d.ts","sourceRoot":"","sources":["../../../../src/candid/utils/leb128.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC;AAOtD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAK5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMhD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAuB5D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAY5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAmC7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAoB7C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAKlF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAmBjF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAajE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAUhE"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeRead = safeRead;
|
|
4
|
+
exports.safeReadUint8 = safeReadUint8;
|
|
5
|
+
exports.lebEncode = lebEncode;
|
|
6
|
+
exports.lebDecode = lebDecode;
|
|
7
|
+
exports.slebEncode = slebEncode;
|
|
8
|
+
exports.slebDecode = slebDecode;
|
|
9
|
+
exports.writeUIntLE = writeUIntLE;
|
|
10
|
+
exports.writeIntLE = writeIntLE;
|
|
11
|
+
exports.readUIntLE = readUIntLE;
|
|
12
|
+
exports.readIntLE = readIntLE;
|
|
13
|
+
// Note: this file uses buffer-pipe, which on Node only, uses the Node Buffer
|
|
14
|
+
// implementation, which isn't compatible with the NPM buffer package
|
|
15
|
+
// which we use everywhere else. This means that we have to transform
|
|
16
|
+
// one into the other, hence why every function that returns a Buffer
|
|
17
|
+
// actually return `new Buffer(pipe.buffer)`.
|
|
18
|
+
// TODO: The best solution would be to have our own buffer type around
|
|
19
|
+
// Uint8Array which is standard.
|
|
20
|
+
const buffer_ts_1 = require("./buffer.js");
|
|
21
|
+
const bigint_math_ts_1 = require("./bigint-math.js");
|
|
22
|
+
function eob() {
|
|
23
|
+
throw new Error('unexpected end of buffer');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param pipe Pipe from buffer-pipe
|
|
28
|
+
* @param num number
|
|
29
|
+
* @returns Uint8Array
|
|
30
|
+
*/
|
|
31
|
+
function safeRead(pipe, num) {
|
|
32
|
+
if (pipe.byteLength < num) {
|
|
33
|
+
eob();
|
|
34
|
+
}
|
|
35
|
+
return pipe.read(num);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @param pipe - PipeArrayBuffer simulating buffer-pipe api
|
|
39
|
+
*/
|
|
40
|
+
function safeReadUint8(pipe) {
|
|
41
|
+
const byte = pipe.readUint8();
|
|
42
|
+
if (byte === undefined) {
|
|
43
|
+
eob();
|
|
44
|
+
}
|
|
45
|
+
return byte;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Encode a positive number (or bigint) into a Buffer. The number will be floored to the
|
|
49
|
+
* nearest integer.
|
|
50
|
+
* @param value The number to encode.
|
|
51
|
+
*/
|
|
52
|
+
function lebEncode(value) {
|
|
53
|
+
if (typeof value === 'number') {
|
|
54
|
+
value = BigInt(value);
|
|
55
|
+
}
|
|
56
|
+
if (value < BigInt(0)) {
|
|
57
|
+
throw new Error('Cannot leb encode negative values.');
|
|
58
|
+
}
|
|
59
|
+
const byteLength = (value === BigInt(0) ? 0 : (0, bigint_math_ts_1.ilog2)(value)) + 1;
|
|
60
|
+
const pipe = new buffer_ts_1.PipeArrayBuffer(new Uint8Array(byteLength), 0);
|
|
61
|
+
while (true) {
|
|
62
|
+
const i = Number(value & BigInt(0x7f));
|
|
63
|
+
value /= BigInt(0x80);
|
|
64
|
+
if (value === BigInt(0)) {
|
|
65
|
+
pipe.write(new Uint8Array([i]));
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
pipe.write(new Uint8Array([i | 0x80]));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return pipe.buffer;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Decode a leb encoded buffer into a bigint. The number will always be positive (does not
|
|
76
|
+
* support signed leb encoding).
|
|
77
|
+
* @param pipe A Buffer containing the leb encoded bits.
|
|
78
|
+
*/
|
|
79
|
+
function lebDecode(pipe) {
|
|
80
|
+
let weight = BigInt(1);
|
|
81
|
+
let value = BigInt(0);
|
|
82
|
+
let byte;
|
|
83
|
+
do {
|
|
84
|
+
byte = safeReadUint8(pipe);
|
|
85
|
+
value += BigInt(byte & 0x7f).valueOf() * weight;
|
|
86
|
+
weight *= BigInt(128);
|
|
87
|
+
} while (byte >= 0x80);
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Encode a number (or bigint) into a Buffer, with support for negative numbers. The number
|
|
92
|
+
* will be floored to the nearest integer.
|
|
93
|
+
* @param value The number to encode.
|
|
94
|
+
*/
|
|
95
|
+
function slebEncode(value) {
|
|
96
|
+
if (typeof value === 'number') {
|
|
97
|
+
value = BigInt(value);
|
|
98
|
+
}
|
|
99
|
+
const isNeg = value < BigInt(0);
|
|
100
|
+
if (isNeg) {
|
|
101
|
+
value = -value - BigInt(1);
|
|
102
|
+
}
|
|
103
|
+
const byteLength = (value === BigInt(0) ? 0 : (0, bigint_math_ts_1.ilog2)(value)) + 1;
|
|
104
|
+
const pipe = new buffer_ts_1.PipeArrayBuffer(new Uint8Array(byteLength), 0);
|
|
105
|
+
while (true) {
|
|
106
|
+
const i = getLowerBytes(value);
|
|
107
|
+
value /= BigInt(0x80);
|
|
108
|
+
// prettier-ignore
|
|
109
|
+
if ((isNeg && value === BigInt(0) && (i & 0x40) !== 0)
|
|
110
|
+
|| (!isNeg && value === BigInt(0) && (i & 0x40) === 0)) {
|
|
111
|
+
pipe.write(new Uint8Array([i]));
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
pipe.write(new Uint8Array([i | 0x80]));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function getLowerBytes(num) {
|
|
119
|
+
const bytes = num % BigInt(0x80);
|
|
120
|
+
if (isNeg) {
|
|
121
|
+
// We swap the bits here again, and remove 1 to do two's complement.
|
|
122
|
+
return Number(BigInt(0x80) - bytes - BigInt(1));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return Number(bytes);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return pipe.buffer;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Decode a leb encoded buffer into a bigint. The number is decoded with support for negative
|
|
132
|
+
* signed-leb encoding.
|
|
133
|
+
* @param pipe A Buffer containing the signed leb encoded bits.
|
|
134
|
+
*/
|
|
135
|
+
function slebDecode(pipe) {
|
|
136
|
+
// Get the size of the buffer, then cut a buffer of that size.
|
|
137
|
+
const pipeView = new Uint8Array(pipe.buffer);
|
|
138
|
+
let len = 0;
|
|
139
|
+
for (; len < pipeView.byteLength; len++) {
|
|
140
|
+
if (pipeView[len] < 0x80) {
|
|
141
|
+
// If it's a positive number, we reuse lebDecode.
|
|
142
|
+
if ((pipeView[len] & 0x40) === 0) {
|
|
143
|
+
return lebDecode(pipe);
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const bytes = new Uint8Array(safeRead(pipe, len + 1));
|
|
149
|
+
let value = BigInt(0);
|
|
150
|
+
for (let i = bytes.byteLength - 1; i >= 0; i--) {
|
|
151
|
+
value = value * BigInt(0x80) + BigInt(0x80 - (bytes[i] & 0x7f) - 1);
|
|
152
|
+
}
|
|
153
|
+
return -value - BigInt(1);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param value bigint or number
|
|
158
|
+
* @param byteLength number
|
|
159
|
+
* @returns Uint8Array
|
|
160
|
+
*/
|
|
161
|
+
function writeUIntLE(value, byteLength) {
|
|
162
|
+
if (BigInt(value) < BigInt(0)) {
|
|
163
|
+
throw new Error('Cannot write negative values.');
|
|
164
|
+
}
|
|
165
|
+
return writeIntLE(value, byteLength);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* @param value - bigint or number
|
|
170
|
+
* @param byteLength - number
|
|
171
|
+
* @returns Uint8Array
|
|
172
|
+
*/
|
|
173
|
+
function writeIntLE(value, byteLength) {
|
|
174
|
+
value = BigInt(value);
|
|
175
|
+
const pipe = new buffer_ts_1.PipeArrayBuffer(new Uint8Array(Math.min(1, byteLength)), 0);
|
|
176
|
+
let i = 0;
|
|
177
|
+
let mul = BigInt(256);
|
|
178
|
+
let sub = BigInt(0);
|
|
179
|
+
let byte = Number(value % mul);
|
|
180
|
+
pipe.write(new Uint8Array([byte]));
|
|
181
|
+
while (++i < byteLength) {
|
|
182
|
+
if (value < 0 && sub === BigInt(0) && byte !== 0) {
|
|
183
|
+
sub = BigInt(1);
|
|
184
|
+
}
|
|
185
|
+
byte = Number((value / mul - sub) % BigInt(256));
|
|
186
|
+
pipe.write(new Uint8Array([byte]));
|
|
187
|
+
mul *= BigInt(256);
|
|
188
|
+
}
|
|
189
|
+
return pipe.buffer;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* @param pipe Pipe from buffer-pipe
|
|
194
|
+
* @param byteLength number
|
|
195
|
+
* @returns bigint
|
|
196
|
+
*/
|
|
197
|
+
function readUIntLE(pipe, byteLength) {
|
|
198
|
+
if (byteLength <= 0 || !Number.isInteger(byteLength)) {
|
|
199
|
+
throw new Error('Byte length must be a positive integer');
|
|
200
|
+
}
|
|
201
|
+
let val = BigInt(safeReadUint8(pipe));
|
|
202
|
+
let mul = BigInt(1);
|
|
203
|
+
let i = 0;
|
|
204
|
+
while (++i < byteLength) {
|
|
205
|
+
mul *= BigInt(256);
|
|
206
|
+
const byte = BigInt(safeReadUint8(pipe));
|
|
207
|
+
val = val + mul * byte;
|
|
208
|
+
}
|
|
209
|
+
return val;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
*
|
|
213
|
+
* @param pipe Pipe from buffer-pipe
|
|
214
|
+
* @param byteLength number
|
|
215
|
+
* @returns bigint
|
|
216
|
+
*/
|
|
217
|
+
function readIntLE(pipe, byteLength) {
|
|
218
|
+
if (byteLength <= 0 || !Number.isInteger(byteLength)) {
|
|
219
|
+
throw new Error('Byte length must be a positive integer');
|
|
220
|
+
}
|
|
221
|
+
let val = readUIntLE(pipe, byteLength);
|
|
222
|
+
const mul = BigInt(2) ** (BigInt(8) * BigInt(byteLength - 1) + BigInt(7));
|
|
223
|
+
if (val >= mul) {
|
|
224
|
+
val -= mul * BigInt(2);
|
|
225
|
+
}
|
|
226
|
+
return val;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=leb128.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leb128.js","sourceRoot":"","sources":["../../../../src/candid/utils/leb128.ts"],"names":[],"mappings":";;AAoBA,4BAKC;AAKD,sCAMC;AAOD,8BAuBC;AAOD,8BAYC;AAOD,gCAmCC;AAOD,gCAoBC;AAQD,kCAKC;AAQD,gCAmBC;AAQD,gCAaC;AAQD,8BAUC;AAzOD,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD,sEAAsE;AACtE,sCAAsC;AACtC,2CAAsD;AACtD,qDAAyC;AAEzC,SAAS,GAAG;IACV,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAU,EAAE,GAAW;IAC9C,IAAI,IAAI,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;QAC1B,GAAG,EAAE,CAAC;IACR,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAU;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAC9B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,GAAG,EAAE,CAAC;IACR,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,KAAsB;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,KAAK,GAAG,MAAM,CAAC,KAAK,CA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,CAAC;IACD,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACf,GAAG,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { type DerEncodedPublicKey, type HttpAgentRequest, type PublicKey, type Signature, SignIdentity, ToCborValue } from '../../agent/index.js';
|
|
2
|
+
import { Principal } from '../../principal/index.js';
|
|
3
|
+
import { PartialIdentity } from './partial.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A single delegation object that is signed by a private key. This is constructed by
|
|
6
|
+
* `DelegationChain.create()`.
|
|
7
|
+
*
|
|
8
|
+
* {@see DelegationChain}
|
|
9
|
+
*/
|
|
10
|
+
export declare class Delegation implements ToCborValue {
|
|
11
|
+
readonly pubkey: Uint8Array;
|
|
12
|
+
readonly expiration: bigint;
|
|
13
|
+
readonly targets?: Principal[] | undefined;
|
|
14
|
+
constructor(pubkey: Uint8Array, expiration: bigint, targets?: Principal[] | undefined);
|
|
15
|
+
toCborValue(): {
|
|
16
|
+
targets?: Principal[] | undefined;
|
|
17
|
+
pubkey: Uint8Array<ArrayBufferLike>;
|
|
18
|
+
expiration: bigint;
|
|
19
|
+
};
|
|
20
|
+
toJSON(): JsonnableDelegation;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Type of ReturnType<Delegation.toJSON>.
|
|
24
|
+
* The goal here is to stringify all non-JSON-compatible types to some bytes representation we can
|
|
25
|
+
* stringify as hex.
|
|
26
|
+
* (Hex shouldn't be ambiguous ever, because you can encode as DER with semantic OIDs).
|
|
27
|
+
*/
|
|
28
|
+
interface JsonnableDelegation {
|
|
29
|
+
expiration: string;
|
|
30
|
+
pubkey: string;
|
|
31
|
+
targets?: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A signed delegation, which lends its identity to the public key in the delegation
|
|
35
|
+
* object. This is constructed by `DelegationChain.create()`.
|
|
36
|
+
*
|
|
37
|
+
* {@see DelegationChain}
|
|
38
|
+
*/
|
|
39
|
+
export interface SignedDelegation {
|
|
40
|
+
delegation: Delegation;
|
|
41
|
+
signature: Signature;
|
|
42
|
+
}
|
|
43
|
+
export interface JsonnableDelegationChain {
|
|
44
|
+
publicKey: string;
|
|
45
|
+
delegations: Array<{
|
|
46
|
+
signature: string;
|
|
47
|
+
delegation: {
|
|
48
|
+
pubkey: string;
|
|
49
|
+
expiration: string;
|
|
50
|
+
targets?: string[];
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A chain of delegations. This is JSON Serializable.
|
|
56
|
+
* This is the object to serialize and pass to a DelegationIdentity. It does not keep any
|
|
57
|
+
* private keys.
|
|
58
|
+
*/
|
|
59
|
+
export declare class DelegationChain {
|
|
60
|
+
readonly delegations: SignedDelegation[];
|
|
61
|
+
readonly publicKey: DerEncodedPublicKey;
|
|
62
|
+
/**
|
|
63
|
+
* Create a delegation chain between two (or more) keys. By default, the expiration time
|
|
64
|
+
* will be very short (15 minutes).
|
|
65
|
+
*
|
|
66
|
+
* To build a chain of more than 2 identities, this function needs to be called multiple times,
|
|
67
|
+
* passing the previous delegation chain into the options argument. For example:
|
|
68
|
+
* @example
|
|
69
|
+
* const rootKey = createKey();
|
|
70
|
+
* const middleKey = createKey();
|
|
71
|
+
* const bottomeKey = createKey();
|
|
72
|
+
*
|
|
73
|
+
* const rootToMiddle = await DelegationChain.create(
|
|
74
|
+
* root, middle.getPublicKey(), Date.parse('2100-01-01'),
|
|
75
|
+
* );
|
|
76
|
+
* const middleToBottom = await DelegationChain.create(
|
|
77
|
+
* middle, bottom.getPublicKey(), Date.parse('2100-01-01'), { previous: rootToMiddle },
|
|
78
|
+
* );
|
|
79
|
+
*
|
|
80
|
+
* // We can now use a delegation identity that uses the delegation above:
|
|
81
|
+
* const identity = DelegationIdentity.fromDelegation(bottomKey, middleToBottom);
|
|
82
|
+
* @param from The identity that will delegate.
|
|
83
|
+
* @param to The identity that gets delegated. It can now sign messages as if it was the
|
|
84
|
+
* identity above.
|
|
85
|
+
* @param expiration The length the delegation is valid. By default, 15 minutes from calling
|
|
86
|
+
* this function.
|
|
87
|
+
* @param options A set of options for this delegation. expiration and previous
|
|
88
|
+
* @param options.previous - Another DelegationChain that this chain should start with.
|
|
89
|
+
* @param options.targets - targets that scope the delegation (e.g. Canister Principals)
|
|
90
|
+
*/
|
|
91
|
+
static create(from: SignIdentity, to: PublicKey, expiration?: Date, options?: {
|
|
92
|
+
previous?: DelegationChain;
|
|
93
|
+
targets?: Principal[];
|
|
94
|
+
}): Promise<DelegationChain>;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a DelegationChain object from a JSON string.
|
|
97
|
+
* @param json The JSON string to parse.
|
|
98
|
+
*/
|
|
99
|
+
static fromJSON(json: string | JsonnableDelegationChain): DelegationChain;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a DelegationChain object from a list of delegations and a DER-encoded public key.
|
|
102
|
+
* @param delegations The list of delegations.
|
|
103
|
+
* @param publicKey The DER-encoded public key of the key-pair signing the first delegation.
|
|
104
|
+
*/
|
|
105
|
+
static fromDelegations(delegations: SignedDelegation[], publicKey: DerEncodedPublicKey): DelegationChain;
|
|
106
|
+
protected constructor(delegations: SignedDelegation[], publicKey: DerEncodedPublicKey);
|
|
107
|
+
toJSON(): JsonnableDelegationChain;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* An Identity that adds delegation to a request. Everywhere in this class, the name
|
|
111
|
+
* innerKey refers to the SignIdentity that is being used to sign the requests, while
|
|
112
|
+
* originalKey is the identity that is being borrowed. More identities can be used
|
|
113
|
+
* in the middle to delegate.
|
|
114
|
+
*/
|
|
115
|
+
export declare class DelegationIdentity extends SignIdentity {
|
|
116
|
+
private _inner;
|
|
117
|
+
private _delegation;
|
|
118
|
+
/**
|
|
119
|
+
* Create a delegation without having access to delegateKey.
|
|
120
|
+
* @param key The key used to sign the requests.
|
|
121
|
+
* @param delegation A delegation object created using `createDelegation`.
|
|
122
|
+
*/
|
|
123
|
+
static fromDelegation(key: Pick<SignIdentity, 'sign'>, delegation: DelegationChain): DelegationIdentity;
|
|
124
|
+
protected constructor(_inner: Pick<SignIdentity, 'sign'>, _delegation: DelegationChain);
|
|
125
|
+
getDelegation(): DelegationChain;
|
|
126
|
+
getPublicKey(): PublicKey;
|
|
127
|
+
sign(blob: Uint8Array): Promise<Signature>;
|
|
128
|
+
transformRequest(request: HttpAgentRequest): Promise<unknown>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A partial delegated identity, representing a delegation chain and the public key that it targets
|
|
132
|
+
*/
|
|
133
|
+
export declare class PartialDelegationIdentity extends PartialIdentity {
|
|
134
|
+
#private;
|
|
135
|
+
/**
|
|
136
|
+
* The Delegation Chain of this identity.
|
|
137
|
+
*/
|
|
138
|
+
get delegation(): DelegationChain;
|
|
139
|
+
private constructor();
|
|
140
|
+
/**
|
|
141
|
+
* Create a {@link PartialDelegationIdentity} from a {@link PublicKey} and a {@link DelegationChain}.
|
|
142
|
+
* @param key The {@link PublicKey} to delegate to.
|
|
143
|
+
* @param delegation a {@link DelegationChain} targeting the inner key.
|
|
144
|
+
*/
|
|
145
|
+
static fromDelegation(key: PublicKey, delegation: DelegationChain): PartialDelegationIdentity;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* List of things to check for a delegation chain validity.
|
|
149
|
+
*/
|
|
150
|
+
export interface DelegationValidChecks {
|
|
151
|
+
/**
|
|
152
|
+
* Check that the scope is amongst the scopes that this delegation has access to.
|
|
153
|
+
*/
|
|
154
|
+
scope?: Principal | string | Array<Principal | string>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Analyze a DelegationChain and validate that it's valid, ie. not expired and apply to the
|
|
158
|
+
* scope.
|
|
159
|
+
* @param chain The chain to validate.
|
|
160
|
+
* @param checks Various checks to validate on the chain.
|
|
161
|
+
*/
|
|
162
|
+
export declare function isDelegationValid(chain: DelegationChain, checks?: DelegationValidChecks): boolean;
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../../../src/identity/identity/delegation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAEd,KAAK,SAAS,EACd,YAAY,EAGZ,WAAW,EACZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAuB/C;;;;;GAKG;AACH,qBAAa,UAAW,YAAW,WAAW;aAE1B,MAAM,EAAE,UAAU;aAClB,UAAU,EAAE,MAAM;aAClB,OAAO,CAAC,EAAE,SAAS,EAAE;gBAFrB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,SAAS,EAAE,YAAA;IAGhC,WAAW;;;;;IAUX,MAAM,IAAI,mBAAmB;CAUrC;AAED;;;;;GAKG;AACH,UAAU,mBAAmB;IAE3B,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,SAAS,C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