identity/identity library

Classes

Delegation
DelegationChain
A chain of delegations. This is JSON Serializable. This is the object to serialize and pass to a DelegationIdentity. It does not keep any private keys.
DelegationIdentity
An Identity that adds delegation to a request. Everywhere in this class, the name innerKey refers to the SignIdentity that is being used to sign the requests, while originalKey is the identity that is being borrowed. More identities can be used in the middle to delegate.
DelegationIdentityPublicKey
Ed25519KeyIdentity
Ed25519KeyIdentityRecoveredFromII
Ed25519KeyPair
Ed25519PublicKey
P256Identity
P256KeyPair
P256PublicKey
SchnorrIdentity
SchnorrKeyPair
SchnorrPublicKey
Secp256k1KeyIdentity
Secp256k1KeyPair
Secp256k1PublicKey
SignedDelegation

Constants

hardened → const int
The following part is ported from InternetIdentity service. It's main purpose is to recover an identity that registered. These truths are covered.
icBasePath → const List<int>
icDerivationPath → const List<int>

Properties

authDelegationDomainSeparator Uint8List
final
canisterCOSEDer Uint8List
final
oidEd25519 Uint8List
A DER encoded SEQUENCE(OID) for the Ed25519 algorithm.
final
oidP256 Uint8List
final
oidSecp256k1 Uint8List
final
oisCOSEDer Uint8List
A DER encoded SEQUENCE(OID) for DER-encoded-COSE.
final
requestDomainSeparator Uint8List
final

Functions

bufEquals(ByteBuffer b1, ByteBuffer b2) bool
bytesUnwrapDer(Uint8List derEncoded, Uint8List oid) Uint8List
Extracts a payload from the given derEncoded data, and checks that it was tagged with the given oid.
bytesUnwrapDerSignature(Uint8List derEncoded) Uint8List
ECDSA DER Signature 0x30|b1|0x02|b2|r|0x02|b3|s b1 = Length of remaining data b2 = Length of r b3 = Length of s
bytesWrapDer(Uint8List payload, Uint8List oid) Uint8List
Wraps the given payload in a DER encoding tagged with the given encoded oid like so: SEQUENCE(oid, BITSTRING(payload))
bytesWrapDerSignature(Uint8List rawSignature) Uint8List
decodeLenBytes(Uint8List buf, int offset) int
derive(Uint8List parentKey, Uint8List parentChaincode, int i) Set<Uint8List>
dropLeadingUserNumber(String s) String
encodeLen(Uint8List buf, int offset, int len) int
encodeLenBytes(int len) int
extractUserNumber(String s) BigInt?
fromMnemonicWithoutValidation(String mnemonic, List<int>? derivationPath, {int offset = hardened}) Future<Ed25519KeyIdentity>
Create an Ed25519 based on a mnemonic phrase according to SLIP 0010: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
fromSeedWithSlip0010(Uint8List masterSeed, List<int>? derivationPath, {int offset = hardened}) Future<Ed25519KeyIdentity>
Create an Ed25519 according to SLIP 0010: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
generateMasterKey(Uint8List seed) Set<Uint8List>
getECShareSecret(Uint8List privateKey, Uint8List rawPublicKey) Future<Uint8List>
getP256ShareSecret(Uint8List privateKey, Uint8List rawPublicKey) Future<Uint8List>
isDerPublicKey(Uint8List pub, Uint8List oid) bool
isDerSignature(Uint8List sig) bool
parseUserNumber(String s) BigInt?
BigInt parses various things we do not want to allow, like:
recoverSecp256k1PubKey(Uint8List preHashedMessage, Uint8List signature) Future<Uint8List>
signP256Async(Uint8List blob, Uint8List seed) Future<Uint8List>
signSchnorrAsync(Uint8List blob, Uint8List seed, {Uint8List? auxRand}) Future<Uint8List>
signSecp256k1(String message, BinaryBlob secretKey) Uint8List
signSecp256k1Async(Uint8List blob, Uint8List seed) Future<Uint8List>
signSecp256k1Recoverable(Uint8List blob, Uint8List seed) Future<Uint8List>
signSecp256k1WithRNG(Uint8List blob, Uint8List bytes) Future<Uint8List>
toBigEndianArray(int n) Uint8List
Converts a 32-bit unsigned integer to a big endian byte array.
verifyP256Async(Uint8List blob, Uint8List signature, P256PublicKey publicKey) Future<bool>
verifySchnorrAsync(Uint8List blob, Uint8List signature, SchnorrPublicKey publicKey) Future<bool>
verifySecp256k1(String message, Uint8List signature, Secp256k1PublicKey publicKey) bool
verifySecp256k1Blob(Uint8List blob, Uint8List signature, Secp256k1PublicKey publicKey) bool

Typedefs

SigningFunc = Future<Uint8List> Function(Uint8List blob, Uint8List seed)
VerifyFunc = Future<bool> Function(Uint8List blob, Uint8List signature, P256PublicKey publicKey)